NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: bin/45660: Overlapping buffer in catman.c.
The following reply was made to PR bin/45660; it has been noted by GNATS.
From: Christian Biere <christianbiere%gmx.de@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc:
Subject: Re: bin/45660: Overlapping buffer in catman.c.
Date: Sun, 27 Nov 2011 14:33:18 +0100
I assume the missing constant format string argument at the first
snprintf() in makecat() is actually a bug. I'm sure the compiler
is warning about this.
Therefore, I propose the following patch instead.
--- catman.c.orig 2011-11-27 14:27:47.788003030 +0100
+++ catman.c 2011-11-27 14:27:32.728003016 +0100
@@ -559,16 +559,17 @@ static void
makecat(const char *manpage, const char *catpage, const char *buildcmd,
const char *crunchcmd)
{
- char crunchbuf[1024];
char sysbuf[2048];
- snprintf(sysbuf, sizeof(sysbuf), buildcmd, manpage);
-
if (*crunchcmd != '\0') {
+ char crunchbuf[1024];
+
snprintf(crunchbuf, sizeof(crunchbuf), crunchcmd, catpage);
- snprintf(sysbuf, sizeof(sysbuf), "%s | %s", sysbuf, crunchbuf);
+ snprintf(sysbuf, sizeof(sysbuf), "%s%s | %s",
+ buildcmd, manpage, crunchbuf);
} else {
- snprintf(sysbuf, sizeof(sysbuf), "%s > %s", sysbuf, catpage);
+ snprintf(sysbuf, sizeof(sysbuf), "%s%s > %s",
+ buildcmd, manpage, catpage);
}
if (f_noprint == 0)
Home |
Main Index |
Thread Index |
Old Index