Check the return code from ASN1_TIME_diff()
The function can fail so we should check the return code.
Found by Coverity
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/5339)
diff --git a/apps/ca.c b/apps/ca.c
index a416f36..26c0778 100644
--- a/apps/ca.c
+++ b/apps/ca.c
@@ -1706,7 +1706,9 @@
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;
}