aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/apply
diff options
context:
space:
mode:
authorBrian Somers <brian@FreeBSD.org>2001-08-20 14:46:40 +0000
committerBrian Somers <brian@FreeBSD.org>2001-08-20 14:46:40 +0000
commitcbe1d3b6307020778153ec838f67bbcd9f5b46b0 (patch)
treee5d043e9d5f4a4d826f6abc4af426f8e7b4410a0 /usr.bin/apply
parent5f32890558c65f1b0e7a68ed17b2ce5f50058864 (diff)
Notes
Diffstat (limited to 'usr.bin/apply')
-rw-r--r--usr.bin/apply/apply.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/apply/apply.c b/usr.bin/apply/apply.c
index 1fc479634dad..bf0b9118ad12 100644
--- a/usr.bin/apply/apply.c
+++ b/usr.bin/apply/apply.c
@@ -143,13 +143,13 @@ main(int argc, char *argv[]) {
p = cmd;
offset = snprintf(cmd, cmdsize, EXEC "%s", argv[0]);
- if ((size_t)offset >= cmdsize)
+ if (offset < 0 || (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)
+ if (offset < 0 || (size_t)offset >= cmdsize)
err(1, "snprintf() failed");
p += offset;
cmdsize -= offset;
@@ -163,7 +163,7 @@ main(int argc, char *argv[]) {
nargs = 1;
} else {
offset = snprintf(cmd, cmdsize, EXEC "%s", argv[0]);
- if ((size_t)offset >= cmdsize)
+ if (offset < 0 || (size_t)offset >= cmdsize)
err(1, "snprintf() failed");
nargs = n;
}
@@ -196,7 +196,7 @@ main(int argc, char *argv[]) {
if (p[0] == magic && isdigit(p[1]) && p[1] != '0') {
offset = snprintf(q, l, "%s",
argv[(++p)[0] - '0']);
- if ((size_t)offset >= l)
+ if (offset < 0 || (size_t)offset >= l)
err(1, "snprintf() failed");
q += offset;
l -= offset;