diff options
author | Ulrich Drepper <drepper@redhat.com> | 1997-11-19 23:03:59 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1997-11-19 23:03:59 +0000 |
commit | 9d9c8e087e6b9ce482bd7b1407568381d4d6a8e6 (patch) | |
tree | dfa78fcf193facf65687cfb732784b02c62f6c19 | |
parent | b038dd54b2930754b6e436e1ec13525d7b8bedee (diff) |
(hsearch_r): Avoid undefinitely search for non-existing entry if
the table is full.
-rw-r--r-- | misc/hsearch_r.c | 6 |
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) |