Module Name:    src
Committed By:   rillig
Date:           Fri Aug 28 06:37:21 UTC 2020

Modified Files:
        src/usr.bin/make: suff.c

Log Message:
make(1): fix assertion failure in suffix handling

Found by running ./build.sh, in the very early stage.
Fixed by restoring the previous behavior of returning NULL for invalid
arguments.


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/usr.bin/make/suff.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/suff.c
diff -u src/usr.bin/make/suff.c:1.125 src/usr.bin/make/suff.c:1.126
--- src/usr.bin/make/suff.c:1.125	Fri Aug 28 04:48:57 2020
+++ src/usr.bin/make/suff.c	Fri Aug 28 06:37:21 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.125 2020/08/28 04:48:57 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.126 2020/08/28 06:37:21 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: suff.c,v 1.125 2020/08/28 04:48:57 rillig Exp $";
+static char rcsid[] = "$NetBSD: suff.c,v 1.126 2020/08/28 06:37:21 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)suff.c	8.4 (Berkeley) 3/21/94";
 #else
-__RCSID("$NetBSD: suff.c,v 1.125 2020/08/28 04:48:57 rillig Exp $");
+__RCSID("$NetBSD: suff.c,v 1.126 2020/08/28 06:37:21 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -624,8 +624,10 @@ SuffParseTransform(char *str, Suff **src
 	if (srcLn == NULL) {
 	    srcLn = Lst_Find(sufflist, SuffSuffIsPrefix, str);
 	} else {
-	    srcLn = Lst_FindFrom(sufflist, Lst_Succ(srcLn),
-				 SuffSuffIsPrefix, str);
+	    LstNode succ = Lst_Succ(srcLn);
+	    srcLn = succ != NULL
+		    ? Lst_FindFrom(sufflist, succ, SuffSuffIsPrefix, str)
+		    : NULL;
 	}
 	if (srcLn == NULL) {
 	    /*

Reply via email to