summaryrefslogtreecommitdiff
path: root/usr.bin/nc
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2019-06-27 18:03:38 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2019-06-27 18:03:38 +0000
commit2fc3f2b1c35e38cea5062540da864e5c6083c4ec (patch)
tree896dd1804f62ec4576a5b845767f9eec7630c40b /usr.bin/nc
parent32cade518fa1930ef2acf6d3220fc6bf6d36f24e (diff)
Some asprintf() calls were checked < 0, rather than the precise == -1.
ok millert nicm tb, etc
Diffstat (limited to 'usr.bin/nc')
-rw-r--r--usr.bin/nc/netcat.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/nc/netcat.c b/usr.bin/nc/netcat.c
index 048502bd1e5..26288560b06 100644
--- a/usr.bin/nc/netcat.c
+++ b/usr.bin/nc/netcat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: netcat.c,v 1.203 2019/02/26 17:32:47 jsing Exp $ */
+/* $OpenBSD: netcat.c,v 1.204 2019/06/27 18:03:37 deraadt Exp $ */
/*
* Copyright (c) 2001 Eric Jackson <ericj@monkey.org>
* Copyright (c) 2015 Bob Beck. All rights reserved.
@@ -1453,12 +1453,12 @@ build_ports(char *p)
for (x = 0; x <= hi - lo; x++) {
cp = arc4random_uniform(x + 1);
portlist[x] = portlist[cp];
- if (asprintf(&portlist[cp], "%d", x + lo) < 0)
+ if (asprintf(&portlist[cp], "%d", x + lo) == -1)
err(1, "asprintf");
}
} else { /* Load ports sequentially. */
for (cp = lo; cp <= hi; cp++) {
- if (asprintf(&portlist[x], "%d", cp) < 0)
+ if (asprintf(&portlist[x], "%d", cp) == -1)
err(1, "asprintf");
x++;
}