summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorderaadt <>2019-06-28 05:47:57 +0000
committerderaadt <>2019-06-28 05:47:57 +0000
commit74ff76124ba7a371400a9f60d5e33192a3732f03 (patch)
tree8992640641b90427fc4e6cd7a43771bf8866c163
parent2e39f4f9ad2b7c91dccfb7b2fb1b6237fef520f5 (diff)
downloadopenbsd-74ff76124ba7a371400a9f60d5e33192a3732f03.tar.gz
openbsd-74ff76124ba7a371400a9f60d5e33192a3732f03.tar.bz2
openbsd-74ff76124ba7a371400a9f60d5e33192a3732f03.zip
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)
-rw-r--r--src/lib/libcrypto/bio/b_print.c9
1 files 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 @@
1/* $OpenBSD: b_print.c,v 1.25 2014/06/12 15:49:28 deraadt Exp $ */ 1/* $OpenBSD: b_print.c,v 1.26 2019/06/28 05:47:57 deraadt Exp $ */
2 2
3/* Theo de Raadt places this file in the public domain. */ 3/* Theo de Raadt places this file in the public domain. */
4 4
@@ -49,13 +49,10 @@ BIO_vprintf(BIO *bio, const char *format, va_list args)
49 char *buf = NULL; 49 char *buf = NULL;
50 50
51 ret = vasprintf(&buf, format, args); 51 ret = vasprintf(&buf, format, args);
52 if (buf == NULL) { 52 if (ret == -1)
53 ret = -1; 53 return (ret);
54 goto fail;
55 }
56 BIO_write(bio, buf, ret); 54 BIO_write(bio, buf, ret);
57 free(buf); 55 free(buf);
58fail:
59 return (ret); 56 return (ret);
60} 57}
61 58