Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make Don't SEGV when Hash_Table is uninitialized



details:   https://anonhg.NetBSD.org/src/rev/ccda9e827cb3
branches:  trunk
changeset: 791345:ccda9e827cb3
user:      sjg <sjg%NetBSD.org@localhost>
date:      Thu Nov 14 00:27:05 2013 +0000

description:
Don't SEGV when Hash_Table is uninitialized

diffstat:

 usr.bin/make/hash.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (36 lines):

diff -r 37af54469c7b -r ccda9e827cb3 usr.bin/make/hash.c
--- a/usr.bin/make/hash.c       Thu Nov 14 00:13:41 2013 +0000
+++ b/usr.bin/make/hash.c       Thu Nov 14 00:27:05 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hash.c,v 1.19 2009/01/24 10:59:09 dsl Exp $    */
+/*     $NetBSD: hash.c,v 1.20 2013/11/14 00:27:05 sjg Exp $    */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: hash.c,v 1.19 2009/01/24 10:59:09 dsl Exp $";
+static char rcsid[] = "$NetBSD: hash.c,v 1.20 2013/11/14 00:27:05 sjg Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)hash.c     8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: hash.c,v 1.19 2009/01/24 10:59:09 dsl Exp $");
+__RCSID("$NetBSD: hash.c,v 1.20 2013/11/14 00:27:05 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -221,6 +221,9 @@
        unsigned h;
        const char *p;
 
+       if (t == NULL || t->bucketPtr == NULL) {
+           return NULL;
+       }
        for (h = 0, p = key; *p;)
                h = (h << 5) - h + *p++;
        p = key;



Home | Main Index | Thread Index | Old Index