mirror of
https://github.com/openssl/openssl.git
synced 2025-01-18 13:44:20 +08:00
Correctly handle case of bad arguments supplied to rsautl
PR: 1659
This commit is contained in:
parent
4c1a6e004a
commit
6b6fe3d8e4
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user