aboutsummaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-08-21 11:09:40 -0400
committerNick Mathewson <nickm@torproject.org>2014-08-21 11:22:42 -0400
commit446e481c90666235bc184cdad6a8578b79fa258e (patch)
tree61968fb750f0fc21710a87a321dd30d43e26e7e3 /src/tools
parenta66fff6381abc5e3a70bd9cf3108560ed79f8d3e (diff)
downloadtor-446e481c90666235bc184cdad6a8578b79fa258e.tar.gz
tor-446e481c90666235bc184cdad6a8578b79fa258e.zip
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]
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/tor-gencert.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/tools/tor-gencert.c b/src/tools/tor-gencert.c
index e799df5cad..fae26ef956 100644
--- a/src/tools/tor-gencert.c
+++ b/src/tools/tor-gencert.c
@@ -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) {