Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/catman PR/45660: Henning Petersen: Overlapping buff...
details: https://anonhg.NetBSD.org/src/rev/3fcc1733b7aa
branches: trunk
changeset: 772218:3fcc1733b7aa
user: christos <christos%NetBSD.org@localhost>
date: Sat Dec 24 23:29:32 2011 +0000
description:
PR/45660: Henning Petersen: Overlapping buffer in catman.c.
diffstat:
usr.sbin/catman/catman.c | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diffs (37 lines):
diff -r 36adb189368f -r 3fcc1733b7aa usr.sbin/catman/catman.c
--- a/usr.sbin/catman/catman.c Sat Dec 24 22:29:48 2011 +0000
+++ b/usr.sbin/catman/catman.c Sat Dec 24 23:29:32 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: catman.c,v 1.30 2011/08/29 20:38:55 joerg Exp $ */
+/* $NetBSD: catman.c,v 1.31 2011/12/24 23:29:32 christos Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -557,18 +557,23 @@
static void
makecat(const char *manpage, const char *catpage, const char *buildcmd,
- const char *crunchcmd)
+ const char *crunchcmd)
{
char crunchbuf[1024];
char sysbuf[2048];
+ int len;
- snprintf(sysbuf, sizeof(sysbuf), buildcmd, manpage);
+ len = snprintf(sysbuf, sizeof(sysbuf), buildcmd, manpage);
+ if (len < 0)
+ err(1, "snprintf");
if (*crunchcmd != '\0') {
snprintf(crunchbuf, sizeof(crunchbuf), crunchcmd, catpage);
- snprintf(sysbuf, sizeof(sysbuf), "%s | %s", sysbuf, crunchbuf);
+ snprintf(sysbuf + len, sizeof(sysbuf) - len, "%s | %s", sysbuf,
+ crunchbuf);
} else {
- snprintf(sysbuf, sizeof(sysbuf), "%s > %s", sysbuf, catpage);
+ snprintf(sysbuf + len, sizeof(sysbuf) - len, "%s > %s", sysbuf,
+ catpage);
}
if (f_noprint == 0)
Home |
Main Index |
Thread Index |
Old Index