Module Name:    src
Committed By:   rillig
Date:           Sun Jan 15 23:32:11 UTC 2023

Modified Files:
        src/usr.bin/xlint/xlint: xlint.c

Log Message:
xlint: fix null pointer dereference for lint -V (since today)

Building the argument lists further away from the vfork call in xlint.c
1.100 had the side effect that the trailing null pointer was added
outside run_child.


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/usr.bin/xlint/xlint/xlint.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/xlint/xlint/xlint.c
diff -u src/usr.bin/xlint/xlint/xlint.c:1.103 src/usr.bin/xlint/xlint/xlint.c:1.104
--- src/usr.bin/xlint/xlint/xlint.c:1.103	Sun Jan 15 22:26:49 2023
+++ src/usr.bin/xlint/xlint/xlint.c	Sun Jan 15 23:32:10 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: xlint.c,v 1.103 2023/01/15 22:26:49 rillig Exp $ */
+/* $NetBSD: xlint.c,v 1.104 2023/01/15 23:32:10 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: xlint.c,v 1.103 2023/01/15 22:26:49 rillig Exp $");
+__RCSID("$NetBSD: xlint.c,v 1.104 2023/01/15 23:32:10 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -750,7 +750,7 @@ run_child(const char *path, list *args, 
 
 	if (Vflag) {
 		print_sh_quoted(args->items[0]);
-		for (size_t i = 1; i < args->len; i++) {
+		for (size_t i = 1; i < args->len - 1; i++) {
 			(void)printf(" ");
 			print_sh_quoted(args->items[i]);
 		}

Reply via email to