summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorderaadt@openbsd.org <deraadt@openbsd.org>2019-06-27 18:03:37 +0000
committerDamien Miller <djm@mindrot.org>2019-06-28 11:30:18 +1000
commit5cdbaa78fcb718c39af4522d98016ad89d065427 (patch)
tree8bd947edc2f0139849a76efdcf97f96465683cc9
parentb2e3e57be4a933d9464bccbe592573725765486f (diff)
upstream: Some asprintf() calls were checked < 0, rather than the
precise == -1. ok millert nicm tb, etc OpenBSD-Commit-ID: caecf8f57938685c04f125515b9f2806ad408d53
-rw-r--r--auth-options.c4
-rw-r--r--hostfile.c6
-rw-r--r--misc.c4
-rw-r--r--sshkey-xmss.c14
4 files changed, 14 insertions, 14 deletions
diff --git a/auth-options.c b/auth-options.c
index b05d6d6f3..4923a83b7 100644
--- a/auth-options.c
+++ b/auth-options.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: auth-options.c,v 1.84 2018/10/03 06:38:35 djm Exp $ */ 1/* $OpenBSD: auth-options.c,v 1.85 2019/06/27 18:03:37 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2018 Damien Miller <djm@mindrot.org> 3 * Copyright (c) 2018 Damien Miller <djm@mindrot.org>
4 * 4 *
@@ -332,7 +332,7 @@ handle_permit(const char **optsp, int allow_bare_port,
332 * Allow a bare port number in permitlisten to indicate a 332 * Allow a bare port number in permitlisten to indicate a
333 * listen_host wildcard. 333 * listen_host wildcard.
334 */ 334 */
335 if (asprintf(&tmp, "*:%s", opt) < 0) { 335 if (asprintf(&tmp, "*:%s", opt) == -1) {
336 *errstrp = "memory allocation failed"; 336 *errstrp = "memory allocation failed";
337 return -1; 337 return -1;
338 } 338 }
diff --git a/hostfile.c b/hostfile.c
index e1f826bdd..eaa237c81 100644
--- a/hostfile.c
+++ b/hostfile.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: hostfile.c,v 1.73 2018/07/16 03:09:13 djm Exp $ */ 1/* $OpenBSD: hostfile.c,v 1.74 2019/06/27 18:03:37 deraadt Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -545,8 +545,8 @@ hostfile_replace_entries(const char *filename, const char *host, const char *ip,
545 /* 545 /*
546 * Prepare temporary file for in-place deletion. 546 * Prepare temporary file for in-place deletion.
547 */ 547 */
548 if ((r = asprintf(&temp, "%s.XXXXXXXXXXX", filename)) < 0 || 548 if ((r = asprintf(&temp, "%s.XXXXXXXXXXX", filename)) = -1 ||
549 (r = asprintf(&back, "%s.old", filename)) < 0) { 549 (r = asprintf(&back, "%s.old", filename)) == -1) {
550 r = SSH_ERR_ALLOC_FAIL; 550 r = SSH_ERR_ALLOC_FAIL;
551 goto fail; 551 goto fail;
552 } 552 }
diff --git a/misc.c b/misc.c
index 009e02bc5..4011ee5f2 100644
--- a/misc.c
+++ b/misc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: misc.c,v 1.137 2019/01/23 21:50:56 dtucker Exp $ */ 1/* $OpenBSD: misc.c,v 1.138 2019/06/27 18:03:37 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000 Markus Friedl. All rights reserved.
4 * Copyright (c) 2005,2006 Damien Miller. All rights reserved. 4 * Copyright (c) 2005,2006 Damien Miller. All rights reserved.
@@ -550,7 +550,7 @@ put_host_port(const char *host, u_short port)
550 550
551 if (port == 0 || port == SSH_DEFAULT_PORT) 551 if (port == 0 || port == SSH_DEFAULT_PORT)
552 return(xstrdup(host)); 552 return(xstrdup(host));
553 if (asprintf(&hoststr, "[%s]:%d", host, (int)port) < 0) 553 if (asprintf(&hoststr, "[%s]:%d", host, (int)port) == -1)
554 fatal("put_host_port: asprintf: %s", strerror(errno)); 554 fatal("put_host_port: asprintf: %s", strerror(errno));
555 debug3("put_host_port: %s", hoststr); 555 debug3("put_host_port: %s", hoststr);
556 return hoststr; 556 return hoststr;
diff --git a/sshkey-xmss.c b/sshkey-xmss.c
index aaae70289..ef39831c6 100644
--- a/sshkey-xmss.c
+++ b/sshkey-xmss.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshkey-xmss.c,v 1.3 2018/07/09 21:59:10 markus Exp $ */ 1/* $OpenBSD: sshkey-xmss.c,v 1.4 2019/06/27 18:03:37 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2017 Markus Friedl. All rights reserved. 3 * Copyright (c) 2017 Markus Friedl. All rights reserved.
4 * 4 *
@@ -467,9 +467,9 @@ sshkey_xmss_get_state(const struct sshkey *k, sshkey_printfn *pr)
467 } 467 }
468 if ((filename = k->xmss_filename) == NULL) 468 if ((filename = k->xmss_filename) == NULL)
469 goto done; 469 goto done;
470 if (asprintf(&lockfile, "%s.lock", filename) < 0 || 470 if (asprintf(&lockfile, "%s.lock", filename) == -1 ||
471 asprintf(&statefile, "%s.state", filename) < 0 || 471 asprintf(&statefile, "%s.state", filename) == -1 ||
472 asprintf(&ostatefile, "%s.ostate", filename) < 0) { 472 asprintf(&ostatefile, "%s.ostate", filename) == -1) {
473 ret = SSH_ERR_ALLOC_FAIL; 473 ret = SSH_ERR_ALLOC_FAIL;
474 goto done; 474 goto done;
475 } 475 }
@@ -594,9 +594,9 @@ sshkey_xmss_update_state(const struct sshkey *k, sshkey_printfn *pr)
594 state->idx = idx; 594 state->idx = idx;
595 if ((filename = k->xmss_filename) == NULL) 595 if ((filename = k->xmss_filename) == NULL)
596 goto done; 596 goto done;
597 if (asprintf(&statefile, "%s.state", filename) < 0 || 597 if (asprintf(&statefile, "%s.state", filename) == -1 ||
598 asprintf(&ostatefile, "%s.ostate", filename) < 0 || 598 asprintf(&ostatefile, "%s.ostate", filename) == -1 ||
599 asprintf(&nstatefile, "%s.nstate", filename) < 0) { 599 asprintf(&nstatefile, "%s.nstate", filename) == -1) {
600 ret = SSH_ERR_ALLOC_FAIL; 600 ret = SSH_ERR_ALLOC_FAIL;
601 goto done; 601 goto done;
602 } 602 }