Check that async_jobs is not negative and not too high.
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Tue, 21 Feb 2017 05:58:04 +0000 (06:58 +0100)
committerRich Salz <rsalz@openssl.org>
Wed, 1 Mar 2017 17:27:36 +0000 (12:27 -0500)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2693)
(cherry picked from commit f8aa15728ba960137faf77b298fa60c1e63dc50f)

apps/speed.c

index df22422ea8e3b1a0f904c90e2c3cba89bfb78949..ad2daab1c1006337a44e37604cbfb24d791973ac 100644 (file)
@@ -1235,7 +1235,7 @@ int speed_main(int argc, char **argv)
 #ifndef NO_FORK
     int multi = 0;
 #endif
-    int async_jobs = 0;
+    unsigned int async_jobs = 0;
 #if !defined(OPENSSL_NO_RSA) || !defined(OPENSSL_NO_DSA) \
     || !defined(OPENSSL_NO_EC)
     long rsa_count = 1;
@@ -1414,6 +1414,12 @@ int speed_main(int argc, char **argv)
                            prog);
                 goto opterr;
             }
+            if (async_jobs > 99999) {
+                BIO_printf(bio_err,
+                           "%s: too many async_jobs\n",
+                           prog);
+                goto opterr;
+            }
 #endif
             break;
         case OPT_MISALIGN: