check return value of ASN1_item_i2d(), Coverity ID 55
authorNils Larsch <nils@openssl.org>
Wed, 4 Apr 2007 19:41:20 +0000 (19:41 +0000)
committerNils Larsch <nils@openssl.org>
Wed, 4 Apr 2007 19:41:20 +0000 (19:41 +0000)
crypto/pkcs7/pk7_doit.c

index 37e35e1677897ff03c649a466e2394e829a7987d..7eb053a656ada173008db15898d8eab56ea5cfc6 100644 (file)
@@ -1056,6 +1056,12 @@ for (ii=0; ii<md_len; ii++) printf("%02X",md_dat[ii]); printf(" calc\n");
 
                alen = ASN1_item_i2d((ASN1_VALUE *)sk, &abuf,
                                                ASN1_ITEM_rptr(PKCS7_ATTR_VERIFY));
+               if (alen <= 0) 
+                       {
+                       PKCS7err(PKCS7_F_PKCS7_SIGNATUREVERIFY,ERR_R_ASN1_LIB);
+                       ret = -1;
+                       goto err;
+                       }
                EVP_VerifyUpdate(&mdc_tmp, abuf, alen);
 
                OPENSSL_free(abuf);