From 9aa00b187a65b1f30789d6274ec31ea86efe7973 Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Thu, 14 Jan 2016 00:25:25 +0000 Subject: To avoid possible time_t overflow use X509_time_adj_ex() Reviewed-by: Viktor Dukhovni --- apps/ocsp.c | 2 +- apps/x509.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/ocsp.c b/apps/ocsp.c index ceda592de9..0c41c4d5de 100644 --- a/apps/ocsp.c +++ b/apps/ocsp.c @@ -914,7 +914,7 @@ static void make_ocsp_response(OCSP_RESPONSE **resp, OCSP_REQUEST *req, bs = OCSP_BASICRESP_new(); thisupd = X509_gmtime_adj(NULL, 0); if (ndays != -1) - nextupd = X509_gmtime_adj(NULL, nmin * 60 + ndays * 3600 * 24); + nextupd = X509_time_adj_ex(NULL, ndays, nmin * 60, NULL); /* Examine each certificate id in the request */ for (i = 0; i < id_count; i++) { diff --git a/apps/x509.c b/apps/x509.c index 283d0552af..37d3a71e4a 100644 --- a/apps/x509.c +++ b/apps/x509.c @@ -1101,8 +1101,7 @@ static int sign(X509 *x, EVP_PKEY *pkey, int days, int clrext, if (X509_gmtime_adj(X509_get_notBefore(x), 0) == NULL) goto err; - if (X509_gmtime_adj(X509_get_notAfter(x), (long)60 * 60 * 24 * days) == - NULL) + if (X509_time_adj_ex(X509_get_notAfter(x), days, 0, NULL) == NULL) goto err; if (!X509_set_pubkey(x, pkey)) -- cgit v1.2.3