From: Ulrich Drepper Date: Wed, 19 Nov 1997 23:03:59 +0000 (+0000) Subject: (hsearch_r): Avoid undefinitely search for non-existing entry if X-Git-Tag: cvs/glibc-2_0_6-pre2~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9d9c8e087e6b9ce482bd7b1407568381d4d6a8e6;p=thirdparty%2Fglibc.git (hsearch_r): Avoid undefinitely search for non-existing entry if the table is full. --- diff --git a/misc/hsearch_r.c b/misc/hsearch_r.c index 980b7c8d722..37be7863d3e 100644 --- a/misc/hsearch_r.c +++ b/misc/hsearch_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. Contributed by Ulrich Drepper This file is part of the GNU C Library. @@ -196,6 +196,10 @@ hsearch_r (item, action, retval, htab) else idx -= hval2; + /* If we visited all entries leave the loop unsuccessfully. */ + if (idx == hval) + break; + /* If entry is found use it. */ if (htab->table[idx].used == hval && strcmp (item.key, htab->table[idx].entry.key) == 0)