mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
Check for duplicate arguments to tor-gencert
Found by coverity, which noticed that if you said tor-gencert -i identity1 -i identity2 we would leak "identity1". [CID 1198201, 1198202, 1198203]
This commit is contained in:
parent
a66fff6381
commit
446e481c90
3
changes/check_dup_args_gencert
Normal file
3
changes/check_dup_args_gencert
Normal file
@ -0,0 +1,3 @@
|
||||
o Minor features:
|
||||
- In tor-gencert, report an error if the user provides the same
|
||||
argument more than once.
|
@ -134,18 +134,30 @@ parse_commandline(int argc, char **argv)
|
||||
fprintf(stderr, "No argument to -i\n");
|
||||
return 1;
|
||||
}
|
||||
if (identity_key_file) {
|
||||
fprintf(stderr, "Duplicate values for -i\n");
|
||||
return -1;
|
||||
}
|
||||
identity_key_file = tor_strdup(argv[++i]);
|
||||
} else if (!strcmp(argv[i], "-s")) {
|
||||
if (i+1>=argc) {
|
||||
fprintf(stderr, "No argument to -s\n");
|
||||
return 1;
|
||||
}
|
||||
if (signing_key_file) {
|
||||
fprintf(stderr, "Duplicate values for -s\n");
|
||||
return -1;
|
||||
}
|
||||
signing_key_file = tor_strdup(argv[++i]);
|
||||
} else if (!strcmp(argv[i], "-c")) {
|
||||
if (i+1>=argc) {
|
||||
fprintf(stderr, "No argument to -c\n");
|
||||
return 1;
|
||||
}
|
||||
if (certificate_file) {
|
||||
fprintf(stderr, "Duplicate values for -c\n");
|
||||
return -1;
|
||||
}
|
||||
certificate_file = tor_strdup(argv[++i]);
|
||||
} else if (!strcmp(argv[i], "-m")) {
|
||||
if (i+1>=argc) {
|
||||
|
Loading…
Reference in New Issue
Block a user