From 506073094cda49a449c421c5b60f60616a6f898a Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 6 Oct 2007 19:03:13 +0000 Subject: * nscd/connections.c (verify_persistent_db): Recognize circular lists. --- nscd/connections.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'nscd') diff --git a/nscd/connections.c b/nscd/connections.c index 0687a26..2572a42 100644 --- a/nscd/connections.c +++ b/nscd/connections.c @@ -378,7 +378,8 @@ verify_persistent_db (void *mem, struct database_pers_head *readhead, int dbnr) nscd_ssize_t he_cnt = 0; for (nscd_ssize_t cnt = 0; cnt < head->module; ++cnt) { - ref_t work = head->array[cnt]; + ref_t first = head->array[cnt]; + ref_t work = first; while (work != ENDREF) { @@ -437,6 +438,10 @@ verify_persistent_db (void *mem, struct database_pers_head *readhead, int dbnr) } work = here->next; + + if (work == first) + /* A circular list, this must not happen. */ + goto fail; } } -- cgit v1.1