diff options
author | ndossche <niels.dossche@ugent.be> | 2023-02-09 11:39:58 +0100 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2023-02-28 14:35:15 +1100 |
commit | de80517c6407a2549a6e2de3a4922414105d07cd (patch) | |
tree | 0013eed758de447a4510c4840a276e71fcdf2a9d | |
parent | b7f3b7d8aba83c7d38db4a393bbfcb6b9c730156 (diff) |
Fix incomplete error check on ASN1_item_i2d()
According to the documentation and my analysis tool
ASN1_item_i2d() can return a negative value on error,
but this is not checked. Fix it by changing the error check condition.
CLA: trivial
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20251)
(cherry picked from commit 5df5032ab02d7a17e07435de777d730bae190253)
-rw-r--r-- | crypto/asn1/asn_pack.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/asn1/asn_pack.c b/crypto/asn1/asn_pack.c index 292e6d8176..f629e6d347 100644 --- a/crypto/asn1/asn_pack.c +++ b/crypto/asn1/asn_pack.c @@ -29,7 +29,7 @@ ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_STRING **oct) OPENSSL_free(octmp->data); octmp->data = NULL; - if ((octmp->length = ASN1_item_i2d(obj, &octmp->data, it)) == 0) { + if ((octmp->length = ASN1_item_i2d(obj, &octmp->data, it)) <= 0) { ERR_raise(ERR_LIB_ASN1, ASN1_R_ENCODE_ERROR); goto err; } |