summaryrefslogtreecommitdiff
path: root/src/or/control.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2006-12-10 04:50:33 +0000
committerRoger Dingledine <arma@torproject.org>2006-12-10 04:50:33 +0000
commit733882315d1e6064b90a5f62f0c34fdc6628e99b (patch)
treed2c75a656cbdfeb00cf0ee0d37718273dd1c0566 /src/or/control.c
parentf7319a0b6dae56525fa3ba1d83c212bfe39483de (diff)
downloadtor-733882315d1e6064b90a5f62f0c34fdc6628e99b.tar.gz
tor-733882315d1e6064b90a5f62f0c34fdc6628e99b.zip
resolve a buffer overflow / crash from r9051
svn:r9061
Diffstat (limited to 'src/or/control.c')
-rw-r--r--src/or/control.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/or/control.c b/src/or/control.c
index c04135d8d1..7d8aca3b98 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -1512,14 +1512,13 @@ getinfo_helper_dir(control_connection_t *control_conn,
tor_free(url);
smartlist_free(descs);
} else if (!strcmpstart(question, "dir/status/")) {
- size_t len;
- char *cp;
if (get_options()->DirPort) {
+ size_t len=0;
+ char *cp;
smartlist_t *status_list = smartlist_create();
dirserv_get_networkstatus_v2(status_list,
question+strlen("dir/status/"));
SMARTLIST_FOREACH(status_list, cached_dir_t *, d, len += d->dir_len);
- len = 0;
cp = *answer = tor_malloc(len+1);
SMARTLIST_FOREACH(status_list, cached_dir_t *, d, {
memcpy(cp, d->dir, d->dir_len);