summaryrefslogtreecommitdiffstats
path: root/usr.bin/apply/apply.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/apply/apply.c')
-rw-r--r--usr.bin/apply/apply.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/usr.bin/apply/apply.c b/usr.bin/apply/apply.c
index 2224e49..0894957 100644
--- a/usr.bin/apply/apply.c
+++ b/usr.bin/apply/apply.c
@@ -146,11 +146,13 @@ main(int argc, char *argv[]) {
if ((size_t)offset >= cmdsize)
err(1, "snprintf() failed");
p += offset;
+ cmdsize -= offset;
for (i = 1; i <= nargs; i++) {
offset = snprintf(p, cmdsize, " %c%d", magic, i);
if ((size_t)offset >= cmdsize)
err(1, "snprintf() failed");
p += offset;
+ cmdsize -= offset;
}
/*
@@ -197,6 +199,7 @@ main(int argc, char *argv[]) {
if ((size_t)offset >= l)
err(1, "snprintf() failed");
q += offset;
+ l -= offset;
} else
*q++ = *p;
OpenPOWER on IntegriCloud