diff options
| author | deraadt <> | 2019-06-28 05:47:57 +0000 |
|---|---|---|
| committer | deraadt <> | 2019-06-28 05:47:57 +0000 |
| commit | c1fcaeae79bc31f65b74c1825ddee23b90beee04 (patch) | |
| tree | 8992640641b90427fc4e6cd7a43771bf8866c163 /src/lib/libc | |
| parent | 4ffdd102dbe9fdef90769dee0dd2708be53aae83 (diff) | |
| download | openbsd-c1fcaeae79bc31f65b74c1825ddee23b90beee04.tar.gz openbsd-c1fcaeae79bc31f65b74c1825ddee23b90beee04.tar.bz2 openbsd-c1fcaeae79bc31f65b74c1825ddee23b90beee04.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)
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/bio/b_print.c | 9 |
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); |
| 58 | fail: | ||
| 59 | return (ret); | 56 | return (ret); |
| 60 | } | 57 | } |
| 61 | 58 | ||
