Fix Coverity defects 99/175099/1 accepted/tizen_5.0_unified tizen_5.0 accepted/tizen/5.0/unified/20181102.025950 accepted/tizen/unified/20180416.213743 submit/tizen/20180413.092019 submit/tizen/20180415.233519 submit/tizen_5.0/20181101.000008
authorDongsun Lee <ds73.lee@samsung.com>
Sun, 8 Apr 2018 23:58:53 +0000 (08:58 +0900)
committerDongsun Lee <ds73.lee@samsung.com>
Sun, 8 Apr 2018 23:58:53 +0000 (08:58 +0900)
- 78087: Unchecked return value
- 73634: Unchecked return value

Change-Id: I232316246682914718979312beb87e842636fae3
Signed-off-by: Dongsun Lee <ds73.lee@samsung.com>
src/openssl/x509vfy.c

index 155e1ab..f828afb 100644 (file)
@@ -291,7 +291,14 @@ xmlSecOpenSSLX509StoreVerify(xmlSecKeyDataStorePtr store, XMLSEC_STACK_OF_X509*
         if(xmlSecOpenSSLX509FindNextChainCert(certs2, cert) == NULL) {
             X509_STORE_CTX xsc;
 
-            X509_STORE_CTX_init (&xsc, ctx->xst, cert, certs2);
+            if(!X509_STORE_CTX_init(&xsc, ctx->xst, cert, certs2)) {
+                xmlSecError(XMLSEC_ERRORS_HERE,
+                            xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
+                            "X509_STORE_CTX_init",
+                            XMLSEC_ERRORS_R_CRYPTO_FAILED,
+                            XMLSEC_ERRORS_NO_MESSAGE);
+                goto done;
+            }
             if(keyInfoCtx->certsVerificationTime > 0) {
                 X509_STORE_CTX_set_time(&xsc, 0, keyInfoCtx->certsVerificationTime);
             }
@@ -741,7 +748,15 @@ xmlSecOpenSSLX509VerifyCRL(X509_STORE* xst, X509_CRL *crl ) {
     xmlSecAssert2(xst != NULL, -1);
     xmlSecAssert2(crl != NULL, -1);
 
-    X509_STORE_CTX_init(&xsc, xst, NULL, NULL);
+    ret = X509_STORE_CTX_init(&xsc, xst, NULL, NULL);
+    if(ret <= 0) {
+        xmlSecError(XMLSEC_ERRORS_HERE,
+                    NULL,
+                    "X509_STORE_CTX_init",
+                    XMLSEC_ERRORS_R_CRYPTO_FAILED,
+                    XMLSEC_ERRORS_NO_MESSAGE);
+        return(-1);
+    }
     ret = X509_STORE_get_by_subject(&xsc, X509_LU_X509,
                                     X509_CRL_get_issuer(crl), &xobj);
     if(ret <= 0) {