]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
(hsearch_r): Avoid undefinitely search for non-existing entry if
authorUlrich Drepper <drepper@redhat.com>
Wed, 19 Nov 1997 23:03:59 +0000 (23:03 +0000)
committerUlrich Drepper <drepper@redhat.com>
Wed, 19 Nov 1997 23:03:59 +0000 (23:03 +0000)
the table is full.

misc/hsearch_r.c

index 980b7c8d7226d82ecd7c23fedfcbb15b2ffd8fea..37be7863d3e770924fee3f2a1790f789b4131467 100644 (file)
@@ -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)