From 733882315d1e6064b90a5f62f0c34fdc6628e99b Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Sun, 10 Dec 2006 04:50:33 +0000 Subject: resolve a buffer overflow / crash from r9051 svn:r9061 --- src/or/control.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/or') 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); -- cgit v1.2.3-54-g00ecf