X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=crypto%2Fasn1%2Ftasn_enc.c;h=411b53e0625bcbfaec17b3e4fb891d1f24988d84;hb=8d76481b189b7195ef932e0fb8f0e23ab0120771;hp=3b723a1845db5b88180abed8fe39d3829a0c7e09;hpb=c4d3c19b4c17ed5d9da790dd330409ce11e6a499;p=oweals%2Fopenssl.git diff --git a/crypto/asn1/tasn_enc.c b/crypto/asn1/tasn_enc.c index 3b723a1845..411b53e062 100644 --- a/crypto/asn1/tasn_enc.c +++ b/crypto/asn1/tasn_enc.c @@ -1,7 +1,7 @@ /* * Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved. * - * Licensed under the OpenSSL license (the "License"). You may not use + * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html @@ -57,12 +57,14 @@ static int asn1_item_flags_i2d(ASN1_VALUE *val, unsigned char **out, if (out && !*out) { unsigned char *p, *buf; int len; + len = ASN1_item_ex_i2d(&val, NULL, it, -1, flags); if (len <= 0) return len; - buf = OPENSSL_malloc(len); - if (buf == NULL) + if ((buf = OPENSSL_malloc(len)) == NULL) { + ASN1err(ASN1_F_ASN1_ITEM_FLAGS_I2D, ERR_R_MALLOC_FAILURE); return -1; + } p = buf; ASN1_item_ex_i2d(&val, &p, it, -1, flags); *out = buf;