Sparse array limit testing: reduce the range limit for the number of bits
[openssl.git] / apps / version.c
index c9727daf5203228b3f1d403745201de9d38cb94d..f9d280c72387a81c73d616b60c2928ba354be8fc 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
  *
- * Licensed under the OpenSSL license (the "License").  You may not use
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
  * in the file LICENSE in the source distribution or at
  * https://www.openssl.org/source/license.html
@@ -11,6 +11,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include "apps.h"
+#include "progs.h"
 #include <openssl/evp.h>
 #include <openssl/crypto.h>
 #include <openssl/bn.h>
@@ -72,6 +73,7 @@ int version_main(int argc, char **argv)
         switch (o) {
         case OPT_EOF:
         case OPT_ERR:
+opthelp:
             BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
             goto end;
         case OPT_HELP:
@@ -103,15 +105,21 @@ int version_main(int argc, char **argv)
             dirty = version = 1;
             break;
         case OPT_A:
-            seed = cflags = version = date = platform = dir = engdir = 1;
+            seed = options = cflags = version = date = platform = dir = engdir
+                = 1;
             break;
         }
     }
+    if (opt_num_rest() != 0) {
+        BIO_printf(bio_err, "Extra parameters given.\n");
+        goto opthelp;
+    }
     if (!dirty)
         version = 1;
 
     if (version) {
-        if (OpenSSL_version_num() == OPENSSL_VERSION_NUMBER)
+        if (strcmp(OpenSSL_version(OPENSSL_FULL_VERSION_STRING),
+                   OPENSSL_FULL_VERSION_STR) == 0)
             printf("%s\n", OpenSSL_version(OPENSSL_VERSION));
         else
             printf("%s (Library: %s)\n",
@@ -183,5 +191,5 @@ int version_main(int argc, char **argv)
     }
     ret = 0;
  end:
-    return (ret);
+    return ret;
 }