diff options
author | Pauli <pauli@openssl.org> | 2021-04-12 11:36:50 +1000 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2021-04-14 17:00:04 +1000 |
commit | 4e1ebda9d9f079ba25638aa8b61393865520c2b1 (patch) | |
tree | 53b9be3b91c607e774229ff39d2518a04c0b67c3 | |
parent | 5c107243877121f84037a5aaf19457f87458e8ed (diff) |
bio: add a malloc failed error to BIO_print
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14829)
-rw-r--r-- | crypto/bio/b_print.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/crypto/bio/b_print.c b/crypto/bio/b_print.c index 08d43d3bd5..ba2c6c5b1f 100644 --- a/crypto/bio/b_print.c +++ b/crypto/bio/b_print.c @@ -835,9 +835,12 @@ doapr_outch(char **sbuffer, *sbuffer = NULL; } else { char *tmpbuf; + tmpbuf = OPENSSL_realloc(*buffer, *maxlen); - if (tmpbuf == NULL) + if (tmpbuf == NULL) { + ERR_raise(ERR_LIB_BIO, ERR_R_MALLOC_FAILURE); return 0; + } *buffer = tmpbuf; } } @@ -929,6 +932,5 @@ int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args) * been large enough.) */ return -1; - else - return (retlen <= INT_MAX) ? (int)retlen : -1; + return (retlen <= INT_MAX) ? (int)retlen : -1; } |