Fix numeric -newkey args.
authorBen Laurie <ben@openssl.org>
Thu, 7 Jan 1999 00:10:32 +0000 (00:10 +0000)
committerBen Laurie <ben@openssl.org>
Thu, 7 Jan 1999 00:10:32 +0000 (00:10 +0000)
Contributed by: Bodo Moeller <3moeller@informatik.uni-hamburg.de>

CHANGES
apps/req.c

diff --git a/CHANGES b/CHANGES
index 430603ad6b65afe8cc20278164e46811316db25e..c7c24ed9e5e187aa37feb321e039dc94ae9ec1ae 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -5,6 +5,9 @@
 
  Changes between 0.9.1c and 0.9.2
 
 
  Changes between 0.9.1c and 0.9.2
 
+  *) Don't blow it for numeric -newkey arguments to apps/req.
+     [Bodo Moeller <3moeller@informatik.uni-hamburg.de>]
+
   *) Temp key "for export" tests were wrong in s3_srvr.c.
      [Anonymous <nobody@replay.com>]
 
   *) Temp key "for export" tests were wrong in s3_srvr.c.
      [Anonymous <nobody@replay.com>]
 
index 1c07c3cdc0ff3de722a99fe8b7c4e082bf9551e0..f37616feffe910088fcc7133c87673389135eba2 100644 (file)
@@ -221,13 +221,16 @@ char **argv;
                        }
                else if (strcmp(*argv,"-newkey") == 0)
                        {
                        }
                else if (strcmp(*argv,"-newkey") == 0)
                        {
+                       int is_numeric;
+
                        if (--argc < 1) goto bad;
                        p= *(++argv);
                        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;
                                {
                                pkey_type=TYPE_RSA;
-                               p+=4;
+                               if(!is_numeric)
+                                   p+=4;
                                newkey= atoi(p);
                                }
                        else
                                newkey= atoi(p);
                                }
                        else