summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Hahn <sebastian@torproject.org>2010-02-22 12:08:58 +0100
committerSebastian Hahn <sebastian@torproject.org>2010-02-22 12:13:58 +0100
commitd41030436cc9b7473bb4f21bc492309553374b78 (patch)
tree25b188f3eb7fedff18348e3a8918d6b88d8ce7fe
parenta7e0b2d6d9f7aaca005d267af6950abe4dd74d89 (diff)
downloadtor-d41030436cc9b7473bb4f21bc492309553374b78.tar.gz
tor-d41030436cc9b7473bb4f21bc492309553374b78.zip
Expand homedirs in paths passed to tor-checkkey
This is so that coverity stops complaining about using a user-supplied string with the open() syscall. Let's see if it works.
-rw-r--r--ChangeLog3
-rw-r--r--src/tools/tor-checkkey.c9
2 files changed, 11 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index be7b30b182..1e39b79ff7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -71,6 +71,9 @@ Changes in version 0.2.2.9-alpha - 2010-02-22
to the circuit build timeout.
- Future-proof the controller protocol a bit by ignoring keyword
arguments we do not recognize.
+ - Expand homedirs passed to tor-checkkey. This should silence a
+ coverity complaint about passing a user-supplied string into
+ open() without checking it.
Changes in version 0.2.1.24 - 2010-02-21
diff --git a/src/tools/tor-checkkey.c b/src/tools/tor-checkkey.c
index 739f7332df..30c223a7a1 100644
--- a/src/tools/tor-checkkey.c
+++ b/src/tools/tor-checkkey.c
@@ -19,6 +19,7 @@ int main(int c, char **v)
RSA *rsa;
int wantdigest=0;
int fname_idx;
+ char *fname=NULL;
init_logging();
if (c < 2) {
@@ -46,7 +47,13 @@ int main(int c, char **v)
fname_idx = 1;
}
- str = read_file_to_str(v[fname_idx], 0, NULL);
+#ifdef MS_WINDOWS
+ fname = tor_strdup(v[fname_idx]);
+#else
+ fname = expand_filename(v[fname_idx]);
+#endif
+ str = read_file_to_str(fname, 0, NULL);
+ tor_free(fname);
if (!str) {
fprintf(stderr, "Couldn't read %s\n", v[fname_idx]);
return 1;