Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/xlint/xlint xlint: fix null pointer dereference for ...



details:   https://anonhg.NetBSD.org/src/rev/795a3e24ea3b
branches:  trunk
changeset: 373074:795a3e24ea3b
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Jan 15 23:32:10 2023 +0000

description:
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.

diffstat:

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

diffs (27 lines):

diff -r d714b5bfcb1d -r 795a3e24ea3b usr.bin/xlint/xlint/xlint.c
--- a/usr.bin/xlint/xlint/xlint.c       Sun Jan 15 23:31:51 2023 +0000
+++ b/usr.bin/xlint/xlint/xlint.c       Sun Jan 15 23:32:10 2023 +0000
@@ -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 @@
 
        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]);
                }



Home | Main Index | Thread Index | Old Index