Skip to content

Commit

Permalink
* nscd/connections.c (verify_persistent_db): Recognize circular lists.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulrich Drepper committed Oct 6, 2007
1 parent 8c7661b commit 5060730
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
2007-10-06 Ulrich Drepper <drepper@redhat.com>

* nscd/nscd_helper.c (__nscd_cache_search): Prevent endless loops.
* nscd/connections.c (verify_persistent_db): Recognize circular lists.

[BZ #4407]
* sysdeps/ieee754/dbl-64/e_lgamma_r.c: Fix *signgamp for -0.0.
Expand Down
7 changes: 6 additions & 1 deletion nscd/connections.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
}
}

Expand Down

0 comments on commit 5060730

Please sign in to comment.