Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make make(1): fix null pointer dereference when sys....
details: https://anonhg.NetBSD.org/src/rev/eb9b3b426a41
branches: trunk
changeset: 937947:eb9b3b426a41
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Aug 29 08:59:08 2020 +0000
description:
make(1): fix null pointer dereference when sys.mk is not found
This is quite hard to trigger in a real-life scenario since it requires
precise timing.
Instead, I created /tmp/sys.mk and ran "./make -m /tmp -f /dev/null" in
the debugger, after setting a breakpoint in this line:
ln = Lst_Find(sysMkPath, ReadMakefile, NULL);
Once this line was reached, I removed /tmp/sys.mk to make ReadMakefile
fail. Just adding a few parse errors won't help since ReadMakefile only
fails if the file cannot be found.
diffstat:
usr.bin/make/main.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diffs (36 lines):
diff -r e8c9419f894f -r eb9b3b426a41 usr.bin/make/main.c
--- a/usr.bin/make/main.c Sat Aug 29 08:09:07 2020 +0000
+++ b/usr.bin/make/main.c Sat Aug 29 08:59:08 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.323 2020/08/29 07:52:55 rillig Exp $ */
+/* $NetBSD: main.c,v 1.324 2020/08/29 08:59:08 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.323 2020/08/29 07:52:55 rillig Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.324 2020/08/29 08:59:08 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
@@ -81,7 +81,7 @@
#if 0
static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94";
#else
-__RCSID("$NetBSD: main.c,v 1.323 2020/08/29 07:52:55 rillig Exp $");
+__RCSID("$NetBSD: main.c,v 1.324 2020/08/29 08:59:08 rillig Exp $");
#endif
#endif /* not lint */
#endif
@@ -1329,7 +1329,7 @@
ln = Lst_Find(sysMkPath, ReadMakefile, NULL);
if (ln == NULL)
Fatal("%s: cannot open %s.", progname,
- (char *)Lst_Datum(ln));
+ (char *)Lst_Datum(Lst_First(sysMkPath)));
}
if (!Lst_IsEmpty(makefiles)) {
Home |
Main Index |
Thread Index |
Old Index