argv was set but unused

Also gives an error message when you gave it a parameter it didn't expect.

Reviewed-by: Rich Salz <rsalz@openssl.org>

MR: #2009
This commit is contained in:
Kurt Roeckx 2016-02-14 20:45:02 +01:00
parent 5ee719da04
commit 0335851754
23 changed files with 55 additions and 23 deletions

View file

@ -184,7 +184,8 @@ int asn1parse_main(int argc, char **argv)
}
}
argc = opt_num_rest();
argv = opt_rest();
if (argc != 0)
goto opthelp;
if (oidfile != NULL) {
in = bio_open_default(oidfile, 'r', FORMAT_TEXT);

View file

@ -227,7 +227,8 @@ int crl_main(int argc, char **argv)
}
}
argc = opt_num_rest();
argv = opt_rest();
if (argc != 0)
goto opthelp;
if (!nmflag_set)
nmflag = XN_FLAG_ONELINE;

View file

@ -146,7 +146,8 @@ int crl2pkcs7_main(int argc, char **argv)
}
}
argc = opt_num_rest();
argv = opt_rest();
if (argc != 0)
goto opthelp;
if (!nocrl) {
in = bio_open_default(infile, 'r', informat);

View file

@ -194,7 +194,9 @@ int dsa_main(int argc, char **argv)
}
}
argc = opt_num_rest();
argv = opt_rest();
if (argc != 0)
goto opthelp;
private = pubin || pubout ? 0 : 1;
if (text && !pubin)
private = 1;

View file

@ -205,7 +205,9 @@ int ec_main(int argc, char **argv)
}
}
argc = opt_num_rest();
argv = opt_rest();
if (argc != 0)
goto opthelp;
private = param_out || pubin || pubout ? 0 : 1;
if (text && !pubin)
private = 1;

View file

@ -220,7 +220,9 @@ int ecparam_main(int argc, char **argv)
}
}
argc = opt_num_rest();
argv = opt_rest();
if (argc != 0)
goto opthelp;
private = genkey ? 1 : 0;
in = bio_open_default(infile, 'r', informat);

View file

@ -170,7 +170,9 @@ int genpkey_main(int argc, char **argv)
}
}
argc = opt_num_rest();
argv = opt_rest();
if (argc != 0)
goto opthelp;
private = do_param ? 0 : 1;
if (ctx == NULL)

View file

@ -89,6 +89,7 @@ int nseq_main(int argc, char **argv)
switch (o) {
case OPT_EOF:
case OPT_ERR:
opthelp:
BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
goto end;
case OPT_HELP:
@ -107,7 +108,8 @@ int nseq_main(int argc, char **argv)
}
}
argc = opt_num_rest();
argv = opt_rest();
if (argc != 0)
goto opthelp;
in = bio_open_default(infile, 'r', FORMAT_PEM);
if (in == NULL)

View file

@ -491,7 +491,8 @@ int ocsp_main(int argc, char **argv)
}
}
argc = opt_num_rest();
argv = opt_rest();
if (argc != 0)
goto opthelp;
/* Have we anything to do? */
if (!req && !reqin && !respin && !(port && ridx_filename))

View file

@ -325,7 +325,9 @@ int pkcs12_main(int argc, char **argv)
}
}
argc = opt_num_rest();
argv = opt_rest();
if (argc != 0)
goto opthelp;
private = 1;
if (passarg) {

View file

@ -191,7 +191,8 @@ int pkcs7_main(int argc, char **argv)
}
}
argc = opt_num_rest();
argv = opt_rest();
if (argc != 0)
goto opthelp;
in = bio_open_default(infile, 'r', informat);
if (in == NULL)

View file

@ -225,7 +225,9 @@ int pkcs8_main(int argc, char **argv)
}
}
argc = opt_num_rest();
argv = opt_rest();
if (argc != 0)
goto opthelp;
private = 1;
if (!app_passwd(passinarg, passoutarg, &passin, &passout)) {

View file

@ -159,7 +159,9 @@ int pkey_main(int argc, char **argv)
}
}
argc = opt_num_rest();
argv = opt_rest();
if (argc != 0)
goto opthelp;
private = !noout && !pubout ? 1 : 0;
if (text && !pubtext)
private = 1;

View file

@ -92,6 +92,7 @@ int pkeyparam_main(int argc, char **argv)
switch (o) {
case OPT_EOF:
case OPT_ERR:
opthelp:
BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
goto end;
case OPT_HELP:
@ -116,7 +117,8 @@ int pkeyparam_main(int argc, char **argv)
}
}
argc = opt_num_rest();
argv = opt_rest();
if (argc != 0)
goto opthelp;
in = bio_open_default(infile, 'r', FORMAT_PEM);
if (in == NULL)

View file

@ -225,7 +225,8 @@ int pkeyutl_main(int argc, char **argv)
}
}
argc = opt_num_rest();
argv = opt_rest();
if (argc != 0)
goto opthelp;
if (inkey == NULL ||
(peerkey != NULL && pkey_op != EVP_PKEY_OP_DERIVE))

View file

@ -367,7 +367,8 @@ int req_main(int argc, char **argv)
}
}
argc = opt_num_rest();
argv = opt_rest();
if (argc != 0)
goto opthelp;
if (!nmflag_set)
nmflag = XN_FLAG_ONELINE;

View file

@ -252,7 +252,9 @@ int rsa_main(int argc, char **argv)
}
}
argc = opt_num_rest();
argv = opt_rest();
if (argc != 0)
goto opthelp;
private = (text && !pubin) || (!pubout && !noout) ? 1 : 0;
if (!app_passwd(passinarg, passoutarg, &passin, &passout)) {

View file

@ -205,7 +205,8 @@ int rsautl_main(int argc, char **argv)
}
}
argc = opt_num_rest();
argv = opt_rest();
if (argc != 0)
goto opthelp;
if (need_priv && (key_type != KEY_PRIVKEY)) {
BIO_printf(bio_err, "A private key is needed for this operation\n");

View file

@ -1341,7 +1341,8 @@ int s_client_main(int argc, char **argv)
}
}
argc = opt_num_rest();
argv = opt_rest();
if (argc != 0)
goto opthelp;
if (proxystr) {
int res;

View file

@ -237,7 +237,8 @@ int s_time_main(int argc, char **argv)
}
}
argc = opt_num_rest();
argv = opt_rest();
if (argc != 0)
goto opthelp;
if (cipher == NULL)
cipher = getenv("SSL_CIPHER");

View file

@ -139,7 +139,8 @@ int sess_id_main(int argc, char **argv)
}
}
argc = opt_num_rest();
argv = opt_rest();
if (argc != 0)
goto opthelp;
x = load_sess_id(infile, informat);
if (x == NULL) {

View file

@ -112,6 +112,7 @@ int spkac_main(int argc, char **argv)
switch (o) {
case OPT_EOF:
case OPT_ERR:
opthelp:
BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
goto end;
case OPT_HELP:
@ -154,7 +155,8 @@ int spkac_main(int argc, char **argv)
}
}
argc = opt_num_rest();
argv = opt_rest();
if (argc != 0)
goto opthelp;
if (!app_passwd(passinarg, NULL, &passin, NULL)) {
BIO_printf(bio_err, "Error getting password\n");

View file

@ -299,7 +299,6 @@ int ts_main(int argc, char **argv)
}
}
argc = opt_num_rest();
argv = opt_rest();
if (mode == OPT_ERR || argc != 0)
goto opthelp;