From 49fd614848af55664645e145d087e988a17b5bd0 Mon Sep 17 00:00:00 2001 From: Ted Lemon Date: Fri, 9 Apr 1999 17:39:41 +0000 Subject: [PATCH] D'oh! Compute length _before_ computing hash! --- common/hash.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/common/hash.c b/common/hash.c index 03beec736..58ed7c67c 100644 --- a/common/hash.c +++ b/common/hash.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: hash.c,v 1.9.2.2 1999/04/08 21:25:44 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n"; +"$Id: hash.c,v 1.9.2.3 1999/04/09 17:39:41 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -150,11 +150,12 @@ unsigned char *hash_lookup (table, name, len) if (!table) return (unsigned char *)0; - hashno = do_hash (name, len, table -> hash_count); if (!len) len = strlen ((char *)name); + hashno = do_hash (name, len, table -> hash_count); + for (bp = table -> buckets [hashno]; bp; bp = bp -> next) { if (len == bp -> len && !memcmp (bp -> name, name, len)) return bp -> value; -- 2.47.3