about summary refs log tree commit diff
path: root/nscd/connections.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-10-06 19:03:13 +0000
committerUlrich Drepper <drepper@redhat.com>2007-10-06 19:03:13 +0000
commit506073094cda49a449c421c5b60f60616a6f898a (patch)
tree8bdc564c2f8262085d746d777a7bfa0e1a9b993f /nscd/connections.c
parent8c7661bcd362416493b3088ddf176578b225fb18 (diff)
downloadglibc-506073094cda49a449c421c5b60f60616a6f898a.tar.gz
glibc-506073094cda49a449c421c5b60f60616a6f898a.tar.xz
glibc-506073094cda49a449c421c5b60f60616a6f898a.zip
* nscd/connections.c (verify_persistent_db): Recognize circular lists.
Diffstat (limited to 'nscd/connections.c')
-rw-r--r--nscd/connections.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/nscd/connections.c b/nscd/connections.c
index 0687a2661f..2572a42ee7 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;
 	}
     }