Module Name: src
Committed By: rillig
Date: Sat Nov 7 13:34:46 UTC 2020
Modified Files:
src/usr.bin/make: arch.c
Log Message:
make(1): fix out-of-bounds pointer in ArchStatMember (since 1993-03-21)
To generate a diff of this commit:
cvs rdiff -u -r1.167 -r1.168 src/usr.bin/make/arch.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/arch.c
diff -u src/usr.bin/make/arch.c:1.167 src/usr.bin/make/arch.c:1.168
--- src/usr.bin/make/arch.c:1.167 Sat Nov 7 13:29:38 2020
+++ src/usr.bin/make/arch.c Sat Nov 7 13:34:46 2020
@@ -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 @@ ArchStatMember(const char *archive, cons
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