From 74ff76124ba7a371400a9f60d5e33192a3732f03 Mon Sep 17 00:00:00 2001 From: deraadt <> Date: Fri, 28 Jun 2019 05:47:57 +0000 Subject: 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) --- src/lib/libcrypto/bio/b_print.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/lib/libcrypto/bio/b_print.c b/src/lib/libcrypto/bio/b_print.c index 09747767dd..c9d54809a7 100644 --- a/src/lib/libcrypto/bio/b_print.c +++ b/src/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); } -- cgit v1.2.3-55-g6feb