asn1_item_embed_d2i: fix th return check
authorPeiwei Hu <jlu.hpw@foxmail.com>
Sun, 14 Nov 2021 15:00:00 +0000 (23:00 +0800)
committerTomas Mraz <tomas@openssl.org>
Mon, 22 Nov 2021 13:43:44 +0000 (14:43 +0100)
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17028)

crypto/asn1/tasn_dec.c

index eff67d87fc16a094f9db76e3d1c70c330bfde543..11198087a57b37989cdd2f6253738079db16962c 100644 (file)
@@ -648,9 +648,9 @@ static int asn1_template_noexp_d2i(ASN1_VALUE **val,
                 break;
             }
             skfield = NULL;
-            if (!asn1_item_embed_d2i(&skfield, &p, len,
+            if (asn1_item_embed_d2i(&skfield, &p, len,
                                      ASN1_ITEM_ptr(tt->item), -1, 0, 0, ctx,
-                                     depth, libctx, propq)) {
+                                     depth, libctx, propq) <= 0) {
                 ERR_raise(ERR_LIB_ASN1, ERR_R_NESTED_ASN1_ERROR);
                 /* |skfield| may be partially allocated despite failure. */
                 ASN1_item_free(skfield, ASN1_ITEM_ptr(tt->item));