diff options
author | Lutz Jänicke <jaenicke@openssl.org> | 2008-04-17 13:36:13 +0000 |
---|---|---|
committer | Lutz Jänicke <jaenicke@openssl.org> | 2008-04-17 13:36:13 +0000 |
commit | 6b6fe3d8e4a1ec0f79ad8323933ce29f50261eee (patch) | |
tree | 769081804a77256abdc776dce36f1a6cc7cfac7f /apps/rsautl.c | |
parent | 4c1a6e004a940a66c1d113ea3656a124e3dca1ea (diff) | |
download | openssl-6b6fe3d8e4a1ec0f79ad8323933ce29f50261eee.tar.gz |
Correctly handle case of bad arguments supplied to rsautl
PR: 1659
Diffstat (limited to 'apps/rsautl.c')
-rw-r--r-- | apps/rsautl.c | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/apps/rsautl.c b/apps/rsautl.c index 463890950e..f3c458ed27 100644 --- a/apps/rsautl.c +++ b/apps/rsautl.c @@ -119,24 +119,36 @@ int MAIN(int argc, char **argv) while(argc >= 1) { if (!strcmp(*argv,"-in")) { - if (--argc < 1) badarg = 1; - infile= *(++argv); + if (--argc < 1) + badarg = 1; + else + infile= *(++argv); } else if (!strcmp(*argv,"-out")) { - if (--argc < 1) badarg = 1; - outfile= *(++argv); + if (--argc < 1) + badarg = 1; + else + outfile= *(++argv); } else if(!strcmp(*argv, "-inkey")) { - if (--argc < 1) badarg = 1; - keyfile = *(++argv); + if (--argc < 1) + badarg = 1; + else + keyfile = *(++argv); } else if (!strcmp(*argv,"-passin")) { - if (--argc < 1) badarg = 1; - passargin= *(++argv); + if (--argc < 1) + badarg = 1; + else + passargin= *(++argv); } else if (strcmp(*argv,"-keyform") == 0) { - if (--argc < 1) badarg = 1; - keyform=str2fmt(*(++argv)); + if (--argc < 1) + badarg = 1; + else + keyform=str2fmt(*(++argv)); #ifndef OPENSSL_NO_ENGINE } else if(!strcmp(*argv, "-engine")) { - if (--argc < 1) badarg = 1; - engine = *(++argv); + if (--argc < 1) + badarg = 1; + else + engine = *(++argv); #endif } else if(!strcmp(*argv, "-pubin")) { key_type = KEY_PUBKEY; |