[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r9061: resolve a buffer overflow / crash from r9051 (tor/trunk/src/or)
Author: arma
Date: 2006-12-09 23:50:33 -0500 (Sat, 09 Dec 2006)
New Revision: 9061
Modified:
tor/trunk/src/or/control.c
Log:
resolve a buffer overflow / crash from r9051
Modified: tor/trunk/src/or/control.c
===================================================================
--- tor/trunk/src/or/control.c 2006-12-09 19:40:16 UTC (rev 9060)
+++ tor/trunk/src/or/control.c 2006-12-10 04:50:33 UTC (rev 9061)
@@ -1512,14 +1512,13 @@
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);