summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2019-06-27 18:03:36 +0000
committerderaadt <deraadt@openbsd.org>2019-06-27 18:03:36 +0000
commit95af8abf27078f6d0f9a407e501f247e19a4d49c (patch)
tree402427689b0f08e28b0b8d8e77348e34a28da69c
parentEnable MSI-X interrupts. (diff)
downloadwireguard-openbsd-95af8abf27078f6d0f9a407e501f247e19a4d49c.tar.xz
wireguard-openbsd-95af8abf27078f6d0f9a407e501f247e19a4d49c.zip
Some asprintf() calls were checked < 0, rather than the precise == -1.
ok millert nicm tb, etc
-rw-r--r--bin/ksh/edit.c6
-rw-r--r--usr.bin/jot/jot.c10
-rw-r--r--usr.bin/mktemp/mktemp.c4
-rw-r--r--usr.bin/nc/netcat.c6
-rw-r--r--usr.bin/rsync/flist.c8
-rw-r--r--usr.bin/rsync/log.c14
-rw-r--r--usr.bin/rsync/mktemp.c6
-rw-r--r--usr.bin/ssh/auth-options.c4
-rw-r--r--usr.bin/ssh/hostfile.c6
-rw-r--r--usr.bin/ssh/misc.c4
-rw-r--r--usr.bin/ssh/sshkey-xmss.c14
-rw-r--r--usr.bin/unifdef/unifdef.c2
-rw-r--r--usr.sbin/ldapctl/ldapctl.c10
-rw-r--r--usr.sbin/ldapd/namespace.c6
14 files changed, 50 insertions, 50 deletions
diff --git a/bin/ksh/edit.c b/bin/ksh/edit.c
index 2245e0e2049..a7a6c200f0c 100644
--- a/bin/ksh/edit.c
+++ b/bin/ksh/edit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: edit.c,v 1.67 2018/12/30 23:09:58 guenther Exp $ */
+/* $OpenBSD: edit.c,v 1.68 2019/06/27 18:03:36 deraadt Exp $ */
/*
* Command line editing - common code
@@ -614,12 +614,12 @@ x_try_array(const char *buf, int buflen, const char *want, int wantlen,
}
/* Try to find the array. */
- if (asprintf(&name, "complete_%.*s_%d", cmdlen, cmd, n) < 0)
+ if (asprintf(&name, "complete_%.*s_%d", cmdlen, cmd, n) == -1)
internal_errorf("unable to allocate memory");
v = global(name);
free(name);
if (~v->flag & (ISSET|ARRAY)) {
- if (asprintf(&name, "complete_%.*s", cmdlen, cmd) < 0)
+ if (asprintf(&name, "complete_%.*s", cmdlen, cmd) == -1)
internal_errorf("unable to allocate memory");
v = global(name);
free(name);
diff --git a/usr.bin/jot/jot.c b/usr.bin/jot/jot.c
index 99c1d6657cb..c84a8cb2851 100644
--- a/usr.bin/jot/jot.c
+++ b/usr.bin/jot/jot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: jot.c,v 1.48 2018/08/01 13:35:33 tb Exp $ */
+/* $OpenBSD: jot.c,v 1.49 2019/06/27 18:03:36 deraadt Exp $ */
/* $NetBSD: jot.c,v 1.3 1994/12/02 20:29:43 pk Exp $ */
/*-
@@ -357,14 +357,14 @@ getformat(void)
p += 2;
if (p == NULL && !chardata) {
- if (asprintf(&format, "%s%%.%df", format, prec) < 0)
+ if (asprintf(&format, "%s%%.%df", format, prec) == -1)
err(1, NULL);
} else if (p == NULL && chardata) {
- if (asprintf(&format, "%s%%c", format) < 0)
+ if (asprintf(&format, "%s%%c", format) == -1)
err(1, NULL);
} else if (p[1] == '\0') {
/* cannot end in single '%' */
- if (asprintf(&format, "%s%%", format) < 0)
+ if (asprintf(&format, "%s%%", format) == -1)
err(1, NULL);
} else {
/*
@@ -447,7 +447,7 @@ fmt_broken:
if (p[1] != '\0')
errx(1, "too many conversions");
/* cannot end in single '%' */
- if (asprintf(&format, "%s%%", format) < 0)
+ if (asprintf(&format, "%s%%", format) == -1)
err(1, NULL);
}
}
diff --git a/usr.bin/mktemp/mktemp.c b/usr.bin/mktemp/mktemp.c
index a3c30c4daf3..f21b85d925d 100644
--- a/usr.bin/mktemp/mktemp.c
+++ b/usr.bin/mktemp/mktemp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mktemp.c,v 1.23 2019/01/25 00:19:26 millert Exp $ */
+/* $OpenBSD: mktemp.c,v 1.24 2019/06/27 18:03:37 deraadt Exp $ */
/*
* Copyright (c) 1996, 1997, 2001-2003, 2013
@@ -94,7 +94,7 @@ main(int argc, char *argv[])
while (len != 0 && prefix[len - 1] == '/')
len--;
- if (asprintf(&tempfile, "%.*s/%s", (int)len, prefix, template) < 0)
+ if (asprintf(&tempfile, "%.*s/%s", (int)len, prefix, template) == -1)
tempfile = NULL;
} else
tempfile = strdup(template);
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++;
}
diff --git a/usr.bin/rsync/flist.c b/usr.bin/rsync/flist.c
index 4860e20f428..a17929df8f9 100644
--- a/usr.bin/rsync/flist.c
+++ b/usr.bin/rsync/flist.c
@@ -1,4 +1,4 @@
-/* $Id: flist.c,v 1.28 2019/06/23 10:28:32 benno Exp $ */
+/* $Id: flist.c,v 1.29 2019/06/27 18:03:37 deraadt Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2019 Florian Obser <florian@openbsd.org>
@@ -962,7 +962,7 @@ flist_gen_dirent(struct sess *sess, char *root, struct flist **fl, size_t *sz,
/* Our path defaults to "." for the root. */
if (ent->fts_path[stripdir] == '\0') {
- if (asprintf(&f->path, "%s.", ent->fts_path) < 0) {
+ if (asprintf(&f->path, "%s.", ent->fts_path) == -1) {
ERR("asprintf");
f->path = NULL;
goto out;
@@ -1213,7 +1213,7 @@ flist_gen_dels(struct sess *sess, const char *root, struct flist **fl,
if (wflsz && strcmp(wfl[0].wpath, ".") == 0) {
assert(cargvs == 1);
assert(S_ISDIR(wfl[0].st.mode));
- if (asprintf(&cargv[0], "%s/", root) < 0) {
+ if (asprintf(&cargv[0], "%s/", root) == -1) {
ERR("asprintf");
cargv[0] = NULL;
goto out;
@@ -1226,7 +1226,7 @@ flist_gen_dels(struct sess *sess, const char *root, struct flist **fl,
assert(S_ISDIR(wfl[i].st.mode));
assert(strcmp(wfl[i].wpath, "."));
c = asprintf(&cargv[j], "%s/%s", root, wfl[i].wpath);
- if (c < 0) {
+ if (c == -1) {
ERR("asprintf");
cargv[j] = NULL;
goto out;
diff --git a/usr.bin/rsync/log.c b/usr.bin/rsync/log.c
index 1babed65a25..d50edff0f5a 100644
--- a/usr.bin/rsync/log.c
+++ b/usr.bin/rsync/log.c
@@ -1,4 +1,4 @@
-/* $Id: log.c,v 1.7 2019/05/08 20:00:25 benno Exp $ */
+/* $Id: log.c,v 1.8 2019/06/27 18:03:37 deraadt Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -41,7 +41,7 @@ rsync_log(const char *fname, size_t line, int level, const char *fmt, ...)
if (fmt != NULL) {
va_start(ap, fmt);
- if (vasprintf(&buf, fmt, ap) < 0) {
+ if (vasprintf(&buf, fmt, ap) == -1) {
va_end(ap);
return;
}
@@ -69,7 +69,7 @@ rsync_errx(const char *fname, size_t line, const char *fmt, ...)
if (fmt != NULL) {
va_start(ap, fmt);
- if (vasprintf(&buf, fmt, ap) < 0) {
+ if (vasprintf(&buf, fmt, ap) == -1) {
va_end(ap);
return;
}
@@ -95,7 +95,7 @@ rsync_err(const char *fname, size_t line, const char *fmt, ...)
if (fmt != NULL) {
va_start(ap, fmt);
- if (vasprintf(&buf, fmt, ap) < 0) {
+ if (vasprintf(&buf, fmt, ap) == -1) {
va_end(ap);
return;
}
@@ -123,7 +123,7 @@ rsync_errx1(const char *fname, size_t line, const char *fmt, ...)
if (fmt != NULL) {
va_start(ap, fmt);
- if (vasprintf(&buf, fmt, ap) < 0) {
+ if (vasprintf(&buf, fmt, ap) == -1) {
va_end(ap);
return;
}
@@ -147,7 +147,7 @@ rsync_warnx(const char *fname, size_t line, const char *fmt, ...)
if (fmt != NULL) {
va_start(ap, fmt);
- if (vasprintf(&buf, fmt, ap) < 0) {
+ if (vasprintf(&buf, fmt, ap) == -1) {
va_end(ap);
return;
}
@@ -176,7 +176,7 @@ rsync_warn(int level, const char *fname, size_t line, const char *fmt, ...)
if (fmt != NULL) {
va_start(ap, fmt);
- if (vasprintf(&buf, fmt, ap) < 0) {
+ if (vasprintf(&buf, fmt, ap) == -1) {
va_end(ap);
return;
}
diff --git a/usr.bin/rsync/mktemp.c b/usr.bin/rsync/mktemp.c
index ab81cc5a067..b74d3948909 100644
--- a/usr.bin/rsync/mktemp.c
+++ b/usr.bin/rsync/mktemp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mktemp.c,v 1.10 2019/05/08 21:30:11 benno Exp $ */
+/* $OpenBSD: mktemp.c,v 1.11 2019/06/27 18:03:37 deraadt Exp $ */
/*
* Copyright (c) 1996-1998, 2008 Theo de Raadt
* Copyright (c) 1997, 2008-2009 Todd C. Miller
@@ -292,11 +292,11 @@ mktemplate(char **ret, const char *path, int recursive)
dirlen = cp - path;
n = asprintf(ret, "%.*s/.%s.XXXXXXXXXX",
dirlen, path, path + dirlen + 1);
- if (n < 0) {
+ if (n == -1) {
ERR("asprintf");
*ret = NULL;
}
- } else if ((n = asprintf(ret, ".%s.XXXXXXXXXX", path)) < 0) {
+ } else if ((n = asprintf(ret, ".%s.XXXXXXXXXX", path)) == -1) {
ERR("asprintf");
*ret = NULL;
}
diff --git a/usr.bin/ssh/auth-options.c b/usr.bin/ssh/auth-options.c
index 597fea99e91..6f8475506bc 100644
--- a/usr.bin/ssh/auth-options.c
+++ b/usr.bin/ssh/auth-options.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: auth-options.c,v 1.84 2018/10/03 06:38:35 djm Exp $ */
+/* $OpenBSD: auth-options.c,v 1.85 2019/06/27 18:03:37 deraadt Exp $ */
/*
* Copyright (c) 2018 Damien Miller <djm@mindrot.org>
*
@@ -329,7 +329,7 @@ handle_permit(const char **optsp, int allow_bare_port,
* Allow a bare port number in permitlisten to indicate a
* listen_host wildcard.
*/
- if (asprintf(&tmp, "*:%s", opt) < 0) {
+ if (asprintf(&tmp, "*:%s", opt) == -1) {
*errstrp = "memory allocation failed";
return -1;
}
diff --git a/usr.bin/ssh/hostfile.c b/usr.bin/ssh/hostfile.c
index 9dc64b731b6..d73fe690ec5 100644
--- a/usr.bin/ssh/hostfile.c
+++ b/usr.bin/ssh/hostfile.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hostfile.c,v 1.73 2018/07/16 03:09:13 djm Exp $ */
+/* $OpenBSD: hostfile.c,v 1.74 2019/06/27 18:03:37 deraadt Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -542,8 +542,8 @@ hostfile_replace_entries(const char *filename, const char *host, const char *ip,
/*
* Prepare temporary file for in-place deletion.
*/
- if ((r = asprintf(&temp, "%s.XXXXXXXXXXX", filename)) < 0 ||
- (r = asprintf(&back, "%s.old", filename)) < 0) {
+ if ((r = asprintf(&temp, "%s.XXXXXXXXXXX", filename)) = -1 ||
+ (r = asprintf(&back, "%s.old", filename)) == -1) {
r = SSH_ERR_ALLOC_FAIL;
goto fail;
}
diff --git a/usr.bin/ssh/misc.c b/usr.bin/ssh/misc.c
index 40fa0f9da0d..3271eaf2f58 100644
--- a/usr.bin/ssh/misc.c
+++ b/usr.bin/ssh/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.137 2019/01/23 21:50:56 dtucker Exp $ */
+/* $OpenBSD: misc.c,v 1.138 2019/06/27 18:03:37 deraadt Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
* Copyright (c) 2005,2006 Damien Miller. All rights reserved.
@@ -517,7 +517,7 @@ put_host_port(const char *host, u_short port)
if (port == 0 || port == SSH_DEFAULT_PORT)
return(xstrdup(host));
- if (asprintf(&hoststr, "[%s]:%d", host, (int)port) < 0)
+ if (asprintf(&hoststr, "[%s]:%d", host, (int)port) == -1)
fatal("put_host_port: asprintf: %s", strerror(errno));
debug3("put_host_port: %s", hoststr);
return hoststr;
diff --git a/usr.bin/ssh/sshkey-xmss.c b/usr.bin/ssh/sshkey-xmss.c
index c891fc0e1b1..88c1a141dfe 100644
--- a/usr.bin/ssh/sshkey-xmss.c
+++ b/usr.bin/ssh/sshkey-xmss.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshkey-xmss.c,v 1.3 2018/07/09 21:59:10 markus Exp $ */
+/* $OpenBSD: sshkey-xmss.c,v 1.4 2019/06/27 18:03:37 deraadt Exp $ */
/*
* Copyright (c) 2017 Markus Friedl. All rights reserved.
*
@@ -461,9 +461,9 @@ sshkey_xmss_get_state(const struct sshkey *k, sshkey_printfn *pr)
}
if ((filename = k->xmss_filename) == NULL)
goto done;
- if (asprintf(&lockfile, "%s.lock", filename) < 0 ||
- asprintf(&statefile, "%s.state", filename) < 0 ||
- asprintf(&ostatefile, "%s.ostate", filename) < 0) {
+ if (asprintf(&lockfile, "%s.lock", filename) == -1 ||
+ asprintf(&statefile, "%s.state", filename) == -1 ||
+ asprintf(&ostatefile, "%s.ostate", filename) == -1) {
ret = SSH_ERR_ALLOC_FAIL;
goto done;
}
@@ -588,9 +588,9 @@ sshkey_xmss_update_state(const struct sshkey *k, sshkey_printfn *pr)
state->idx = idx;
if ((filename = k->xmss_filename) == NULL)
goto done;
- if (asprintf(&statefile, "%s.state", filename) < 0 ||
- asprintf(&ostatefile, "%s.ostate", filename) < 0 ||
- asprintf(&nstatefile, "%s.nstate", filename) < 0) {
+ if (asprintf(&statefile, "%s.state", filename) == -1 ||
+ asprintf(&ostatefile, "%s.ostate", filename) == -1 ||
+ asprintf(&nstatefile, "%s.nstate", filename) == -1) {
ret = SSH_ERR_ALLOC_FAIL;
goto done;
}
diff --git a/usr.bin/unifdef/unifdef.c b/usr.bin/unifdef/unifdef.c
index 3e13b51a406..03bfff7fc71 100644
--- a/usr.bin/unifdef/unifdef.c
+++ b/usr.bin/unifdef/unifdef.c
@@ -1531,7 +1531,7 @@ astrcat(const char *s1, const char *s2)
{
char *s;
- if (asprintf(&s, "%s%s", s1, s2) < 0)
+ if (asprintf(&s, "%s%s", s1, s2) == -1)
err(2, "asprintf");
return (s);
}
diff --git a/usr.sbin/ldapctl/ldapctl.c b/usr.sbin/ldapctl/ldapctl.c
index 35006cddebc..d9f6a464940 100644
--- a/usr.sbin/ldapctl/ldapctl.c
+++ b/usr.sbin/ldapctl/ldapctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldapctl.c,v 1.11 2018/05/15 11:19:21 reyk Exp $ */
+/* $OpenBSD: ldapctl.c,v 1.12 2019/06/27 18:03:37 deraadt Exp $ */
/*
* Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se>
@@ -101,7 +101,7 @@ compact_namespace(struct namespace *ns, const char *datadir)
{
char *path;
- if (asprintf(&path, "%s/%s_data.db", datadir, ns->suffix) < 0)
+ if (asprintf(&path, "%s/%s_data.db", datadir, ns->suffix) == -1)
return -1;
if (compact_db(path) != 0) {
log_warn("%s", path);
@@ -110,7 +110,7 @@ compact_namespace(struct namespace *ns, const char *datadir)
}
free(path);
- if (asprintf(&path, "%s/%s_indx.db", datadir, ns->suffix) < 0)
+ if (asprintf(&path, "%s/%s_indx.db", datadir, ns->suffix) == -1)
return -1;
if (compact_db(path) != 0) {
log_warn("%s", path);
@@ -150,14 +150,14 @@ index_namespace(struct namespace *ns, const char *datadir)
log_info("indexing namespace %s", ns->suffix);
- if (asprintf(&path, "%s/%s_data.db", DATADIR, ns->suffix) < 0)
+ if (asprintf(&path, "%s/%s_data.db", DATADIR, ns->suffix) == -1)
return -1;
data_db = btree_open(path, BT_NOSYNC | BT_REVERSEKEY, 0644);
free(path);
if (data_db == NULL)
return -1;
- if (asprintf(&path, "%s/%s_indx.db", datadir, ns->suffix) < 0)
+ if (asprintf(&path, "%s/%s_indx.db", datadir, ns->suffix) == -1)
return -1;
indx_db = btree_open(path, BT_NOSYNC, 0644);
free(path);
diff --git a/usr.sbin/ldapd/namespace.c b/usr.sbin/ldapd/namespace.c
index 3af166b93a6..2259f57bde3 100644
--- a/usr.sbin/ldapd/namespace.c
+++ b/usr.sbin/ldapd/namespace.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: namespace.c,v 1.18 2018/05/15 11:19:21 reyk Exp $ */
+/* $OpenBSD: namespace.c,v 1.19 2019/06/27 18:03:37 deraadt Exp $ */
/*
* Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se>
@@ -118,7 +118,7 @@ namespace_open(struct namespace *ns)
if (ns->sync == 0)
db_flags |= BT_NOSYNC;
- if (asprintf(&ns->data_path, "%s/%s_data.db", datadir, ns->suffix) < 0)
+ if (asprintf(&ns->data_path, "%s/%s_data.db", datadir, ns->suffix) == -1)
return -1;
log_info("opening namespace %s", ns->suffix);
ns->data_db = btree_open(ns->data_path, db_flags | BT_REVERSEKEY, 0644);
@@ -127,7 +127,7 @@ namespace_open(struct namespace *ns)
btree_set_cache_size(ns->data_db, ns->cache_size);
- if (asprintf(&ns->indx_path, "%s/%s_indx.db", datadir, ns->suffix) < 0)
+ if (asprintf(&ns->indx_path, "%s/%s_indx.db", datadir, ns->suffix) == -1)
return -1;
ns->indx_db = btree_open(ns->indx_path, db_flags, 0644);
if (ns->indx_db == NULL)