summaryrefslogtreecommitdiffstats
path: root/crypto/asn1
diff options
context:
space:
mode:
authorPavel Kopyl <p.kopyl@samsung.com>2017-10-27 16:13:11 +0300
committerBernd Edlinger <bernd.edlinger@hotmail.de>2017-11-03 15:46:51 +0100
commita6f622bc99ffdc7b34199babb9d200b24a7a6431 (patch)
tree3d135a6aa18fb56667923677a62f4ca98b4efca5 /crypto/asn1
parent157997f0c00f63b6005f3b5b6e0bb659d795e136 (diff)
Add error handling in dsa_main and ASN1_i2d_bio.
CLA: trivial Reviewed-by: Kurt Roeckx <kurt@roeckx.be> Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> (Merged from https://github.com/openssl/openssl/pull/4600)
Diffstat (limited to 'crypto/asn1')
-rw-r--r--crypto/asn1/a_i2d_fp.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/crypto/asn1/a_i2d_fp.c b/crypto/asn1/a_i2d_fp.c
index c3ed991b79..980c65a25d 100644
--- a/crypto/asn1/a_i2d_fp.c
+++ b/crypto/asn1/a_i2d_fp.c
@@ -38,6 +38,9 @@ int ASN1_i2d_bio(i2d_of_void *i2d, BIO *out, unsigned char *x)
int i, j = 0, n, ret = 1;
n = i2d(x, NULL);
+ if (n <= 0)
+ return 0;
+
b = OPENSSL_malloc(n);
if (b == NULL) {
ASN1err(ASN1_F_ASN1_I2D_BIO, ERR_R_MALLOC_FAILURE);