diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2019-06-28 05:47:58 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2019-06-28 05:47:58 +0000 |
commit | aa557d0aa1afbeae689ce7ec46149350e546f2f2 (patch) | |
tree | be7cf513a5871e15684e4449cb9fc80adc6386e9 /lib | |
parent | 543e37ab8f2a9b099a06939fe1f509700621ee79 (diff) |
failed to detect asprintf() error by observing return of -1, instead the
code was inspecting the pointer (which is, sadly, undefined on error, because
the current specification of asprintf is crazy sloppy)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libcrypto/bio/b_print.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/libcrypto/bio/b_print.c b/lib/libcrypto/bio/b_print.c index 09747767dde..c9d54809a76 100644 --- a/lib/libcrypto/bio/b_print.c +++ b/lib/libcrypto/bio/b_print.c @@ -1,4 +1,4 @@ -/* $OpenBSD: b_print.c,v 1.25 2014/06/12 15:49:28 deraadt Exp $ */ +/* $OpenBSD: b_print.c,v 1.26 2019/06/28 05:47:57 deraadt Exp $ */ /* Theo de Raadt places this file in the public domain. */ @@ -49,13 +49,10 @@ BIO_vprintf(BIO *bio, const char *format, va_list args) char *buf = NULL; ret = vasprintf(&buf, format, args); - if (buf == NULL) { - ret = -1; - goto fail; - } + if (ret == -1) + return (ret); BIO_write(bio, buf, ret); free(buf); -fail: return (ret); } |