summaryrefslogtreecommitdiffstats
path: root/crypto/asn1/bio_asn1.c
diff options
context:
space:
mode:
authorShane Lontis <shane.lontis@oracle.com>2021-04-12 05:58:14 +0200
committerShane Lontis <shane.lontis@oracle.com>2021-04-16 04:10:08 +0200
commit42e7d2f10e3658c0c248df8a6edf3c48c477e4b0 (patch)
tree1122340c23e67327e2673fd516c5be2dc666e228 /crypto/asn1/bio_asn1.c
parentSipHash: Fix CTRL API for the digest size. (diff)
downloadopenssl-42e7d2f10e3658c0c248df8a6edf3c48c477e4b0.tar.xz
openssl-42e7d2f10e3658c0c248df8a6edf3c48c477e4b0.zip
Add more negative checks for integers passed to OPENSSL_malloc().
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14830)
Diffstat (limited to 'crypto/asn1/bio_asn1.c')
-rw-r--r--crypto/asn1/bio_asn1.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/asn1/bio_asn1.c b/crypto/asn1/bio_asn1.c
index dc99e2d7c2..19af059a2c 100644
--- a/crypto/asn1/bio_asn1.c
+++ b/crypto/asn1/bio_asn1.c
@@ -118,7 +118,7 @@ static int asn1_bio_new(BIO *b)
static int asn1_bio_init(BIO_ASN1_BUF_CTX *ctx, int size)
{
- if ((ctx->buf = OPENSSL_malloc(size)) == NULL) {
+ if (size <= 0 || (ctx->buf = OPENSSL_malloc(size)) == NULL) {
ERR_raise(ERR_LIB_ASN1, ERR_R_MALLOC_FAILURE);
return 0;
}