Subject: bin/6174: make(1) reads outside of allocated memory
To: None <gnats-bugs@gnats.netbsd.org>
From: ITOH Yasufumi <yasufu-i@is.aist-nara.ac.jp>
List: netbsd-bugs
Date: 09/18/1998 05:30:54
>Number: 6174
>Category: bin
>Synopsis: make(1) reads outside of allocated memory
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Sep 17 13:35:01 1998
>Last-Modified:
>Originator: ITOH Yasufumi
>Organization:
Nara Institute of Science and Technology, Nara, Japan
>Release: 1.3H (Sept. 17, 1998)
>Environment:
System: NetBSD acha.my.domain 1.3H NetBSD 1.3H (UVM) #4: Sun Sep 6 19:01:31 JST 1998 itohy@myname.my.domain:/usr/src/sys/arch/x68k/compile/UVM x68k
>Description:
make reads 1byte before the allocated memory region.
This scarcely harms.
>How-To-Repeat:
purify :-)
>Fix:
Apply the following patch. Aditional trivial patch also included.
diff -u usr.bin/make/parse.c.orig usr.bin/make/parse.c
--- usr.bin/make/parse.c.orig Fri Aug 7 20:14:01 1998
+++ usr.bin/make/parse.c Fri Sep 18 05:24:12 1998
@@ -1486,9 +1486,8 @@
default:
#ifdef SUNSHCMD
- while (*opc != ':')
- if (--opc < line)
- break;
+ while (opc > line && *opc != ':')
+ opc--;
if (strncmp(opc, ":sh", 3) == 0) {
type = VAR_SHELL;
diff -u usr.bin/make/util.c.orig usr.bin/make/util.c
--- usr.bin/make/util.c.orig Thu Feb 5 21:48:09 1998
+++ usr.bin/make/util.c Fri Sep 18 05:24:58 1998
@@ -437,7 +437,7 @@
const char *fmt;
struct tm *tm;
{
- static char months[] = {
+ static char months[][4] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
>Audit-Trail:
>Unformatted: