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 out-of-bounds pointer in ArchStatM...



details:   https://anonhg.NetBSD.org/src/rev/46ea8f9670c9
branches:  trunk
changeset: 942381:46ea8f9670c9
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Nov 07 13:34:46 2020 +0000

description:
make(1): fix out-of-bounds pointer in ArchStatMember (since 1993-03-21)

diffstat:

 usr.bin/make/arch.c |  7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diffs (29 lines):

diff -r e262f2afa0e0 -r 46ea8f9670c9 usr.bin/make/arch.c
--- a/usr.bin/make/arch.c       Sat Nov 07 13:29:38 2020 +0000
+++ b/usr.bin/make/arch.c       Sat Nov 07 13:34:46 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: arch.c,v 1.167 2020/11/07 13:29:38 rillig Exp $        */
+/*     $NetBSD: arch.c,v 1.168 2020/11/07 13:34:46 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -125,7 +125,7 @@
 #include "config.h"
 
 /*     "@(#)arch.c     8.2 (Berkeley) 1/2/94"  */
-MAKE_RCSID("$NetBSD: arch.c,v 1.167 2020/11/07 13:29:38 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.168 2020/11/07 13:34:46 rillig Exp $");
 
 typedef struct List ArchList;
 typedef struct ListNode ArchListNode;
@@ -505,9 +505,8 @@
 
        memcpy(memName, arh.ar_name, sizeof arh.ar_name);
        nameend = memName + AR_MAX_NAME_LEN;
-       while (*nameend == ' ') {
+       while (nameend > memName && *nameend == ' ')
            nameend--;
-       }
        nameend[1] = '\0';
 
 #ifdef SVR4ARCHIVES



Home | Main Index | Thread Index | Old Index