2007-10-06 Ulrich Drepper <drepper@redhat.com>
+ * nscd/nscd_helper.c (__nscd_cache_search): Prevent endless loops.
+
[BZ #4407]
* sysdeps/ieee754/dbl-64/e_lgamma_r.c: Fix *signgamp for -0.0.
* sysdeps/ieee754/flt-32/e_lgammaf_r.c: Likewise.
unsigned long int hash = __nis_hash (key, keylen) % mapped->head->module;
size_t datasize = mapped->datasize;
- ref_t work = mapped->head->array[hash];
+ ref_t first = mapped->head->array[hash];
+ ref_t work = first;
while (work != ENDREF && work + sizeof (struct hashentry) <= datasize)
{
struct hashentry *here = (struct hashentry *) (mapped->data + work);
}
work = here->next;
+ /* Prevent endless loops. This should never happen but perhaps
+ the database got corrupted, accidentally or deliberately. */
+ if (work == first)
+ break;
}
return NULL;