Module Name: src
Committed By: sjg
Date: Thu Nov 14 00:01:28 UTC 2013
Modified Files:
src/usr.bin/make/lst.lib: lstMember.c
Log Message:
Don't SEGV when passed NULL for list.
To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/lst.lib/lstMember.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/make/lst.lib/lstMember.c
diff -u src/usr.bin/make/lst.lib/lstMember.c:1.13 src/usr.bin/make/lst.lib/lstMember.c:1.14
--- src/usr.bin/make/lst.lib/lstMember.c:1.13 Fri Jan 23 21:26:30 2009
+++ src/usr.bin/make/lst.lib/lstMember.c Thu Nov 14 00:01:28 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: lstMember.c,v 1.13 2009/01/23 21:26:30 dsl Exp $ */
+/* $NetBSD: lstMember.c,v 1.14 2013/11/14 00:01:28 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -33,14 +33,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: lstMember.c,v 1.13 2009/01/23 21:26:30 dsl Exp $";
+static char rcsid[] = "$NetBSD: lstMember.c,v 1.14 2013/11/14 00:01:28 sjg Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)lstMember.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: lstMember.c,v 1.13 2009/01/23 21:26:30 dsl Exp $");
+__RCSID("$NetBSD: lstMember.c,v 1.14 2013/11/14 00:01:28 sjg Exp $");
#endif
#endif /* not lint */
#endif
@@ -58,6 +58,9 @@ Lst_Member(Lst l, void *d)
List list = l;
ListNode lNode;
+ if (list == NULL) {
+ return NULL;
+ }
lNode = list->firstPtr;
if (lNode == NULL) {
return NULL;