summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-11-19 23:03:59 +0000
committerUlrich Drepper <drepper@redhat.com>1997-11-19 23:03:59 +0000
commit9d9c8e087e6b9ce482bd7b1407568381d4d6a8e6 (patch)
treedfa78fcf193facf65687cfb732784b02c62f6c19
parentb038dd54b2930754b6e436e1ec13525d7b8bedee (diff)
(hsearch_r): Avoid undefinitely search for non-existing entry if
the table is full.
-rw-r--r--misc/hsearch_r.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/misc/hsearch_r.c b/misc/hsearch_r.c
index 980b7c8d72..37be7863d3 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 <drepper@gnu.ai.mit.edu>
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)