[openssl-commits] [openssl] master update

Richard Levitte levitte at openssl.org
Sat Jan 30 15:24:51 UTC 2016


The branch master has been updated
       via  33254e1c6fa6a1acf28fd0d9b6dc4ee30e569b95 (commit)
      from  421e30ec67451ac653e790295a36461a4069d0e4 (commit)


- Log -----------------------------------------------------------------
commit 33254e1c6fa6a1acf28fd0d9b6dc4ee30e569b95
Author: Richard Levitte <levitte at openssl.org>
Date:   Sat Jan 30 15:39:34 2016 +0100

    Fix opt_imax() call
    
    Not all architectures have a time_t defined the same way.  To make
    sure we get the same result, we need to cast &checkoffset to (intmax_t *)
    and make sure that intmax_t is defined somehow.
    
    To make really sure we don't pass a variable with the wrong size down
    to opt_imax(), we use a temporary intmax_t.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

-----------------------------------------------------------------------

Summary of changes:
 apps/apps.h |  2 ++
 apps/x509.c | 16 ++++++++++------
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/apps/apps.h b/apps/apps.h
index b6e894d..5ea148d 100644
--- a/apps/apps.h
+++ b/apps/apps.h
@@ -145,6 +145,8 @@ int opt_umax(const char *value, uintmax_t *result);
 # else
 #  define opt_imax opt_long
 #  define opt_umax opt_ulong
+#  define intmax_t long
+#  define uintmax_t unsigned long
 # endif
 
 int app_RAND_load_file(const char *file, int dont_warn);
diff --git a/apps/x509.c b/apps/x509.c
index a8d0686..5d6bb96 100644
--- a/apps/x509.c
+++ b/apps/x509.c
@@ -468,12 +468,16 @@ int x509_main(int argc, char **argv)
             break;
         case OPT_CHECKEND:
             checkend = 1;
-            if (!opt_imax(opt_arg(), &checkoffset))
-                goto opthelp;
-            if (checkoffset != (time_t)checkoffset) {
-                BIO_printf(bio_err, "%s: checkend time out of range %s\n",
-                           prog, opt_arg());
-                goto opthelp;
+            {
+                intmax_t temp = 0;
+                if (!opt_imax(opt_arg(), &temp))
+                    goto opthelp;
+                checkoffset = (time_t)temp;
+                if ((intmax_t)checkoffset != temp) {
+                    BIO_printf(bio_err, "%s: checkend time out of range %s\n",
+                               prog, opt_arg());
+                    goto opthelp;
+                }
             }
             break;
         case OPT_CHECKHOST:


More information about the openssl-commits mailing list