summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPauli <pauli@openssl.org>2021-04-12 11:36:50 +1000
committerPauli <pauli@openssl.org>2021-04-14 17:00:04 +1000
commit4e1ebda9d9f079ba25638aa8b61393865520c2b1 (patch)
tree53b9be3b91c607e774229ff39d2518a04c0b67c3
parent5c107243877121f84037a5aaf19457f87458e8ed (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.c8
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;
}