Check the return code from ASN1_TIME_diff()
[openssl.git] / apps / ca.c
index a416f368a82871a254f429b5346a53d9e7854114..26c077858f6f723ebb1e9b0c5583bf820597aa5d 100644 (file)
--- a/apps/ca.c
+++ b/apps/ca.c
@@ -1706,7 +1706,9 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
 
     if (enddate != NULL) {
         int tdays;
-        ASN1_TIME_diff(&tdays, NULL, NULL, X509_get0_notAfter(ret));
+
+        if (!ASN1_TIME_diff(&tdays, NULL, NULL, X509_get0_notAfter(ret)))
+            goto end;
         days = tdays;
     }