]> git.ipfire.org Git - thirdparty/openssl.git/blobdiff - apps/req.c
Fix numeric -newkey args.
[thirdparty/openssl.git] / apps / req.c
index 1c07c3cdc0ff3de722a99fe8b7c4e082bf9551e0..f37616feffe910088fcc7133c87673389135eba2 100644 (file)
@@ -221,13 +221,16 @@ char **argv;
                        }
                else if (strcmp(*argv,"-newkey") == 0)
                        {
+                       int is_numeric;
+
                        if (--argc < 1) goto bad;
                        p= *(++argv);
-                       if ((strncmp("rsa:",p,4) == 0) ||
-                               ((p[0] >= '0') && (p[0] <= '9')))
+                       is_numeric = p[0] >= '0' && p[0] <= '9';
+                       if (strncmp("rsa:",p,4) == 0 || is_numeric)
                                {
                                pkey_type=TYPE_RSA;
-                               p+=4;
+                               if(!is_numeric)
+                                   p+=4;
                                newkey= atoi(p);
                                }
                        else