diff options
author | Roger Dingledine <arma@torproject.org> | 2005-03-22 05:41:05 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2005-03-22 05:41:05 +0000 |
commit | 76a03e86350b36be9118432bf635a3fd1bef6814 (patch) | |
tree | c50e74539901f5043843143d8aa50b158d73ece6 /src/or/control.c | |
parent | 248867caf524a2675569813aeaf9eaf259e92652 (diff) | |
download | tor-76a03e86350b36be9118432bf635a3fd1bef6814.tar.gz tor-76a03e86350b36be9118432bf635a3fd1bef6814.zip |
handle_control_getinfo() was counting msg_len itself,
when that's actually smartlist_join_strings2()'s job.
svn:r3806
Diffstat (limited to 'src/or/control.c')
-rw-r--r-- | src/or/control.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/or/control.c b/src/or/control.c index ced46710de..45c84d1b99 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -589,7 +589,6 @@ handle_control_getinfo(connection_t *conn, uint32_t len, const char *body) smartlist_split_string(questions, body, "\n", SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, 0); answers = smartlist_create(); - msg_len = 0; SMARTLIST_FOREACH(questions, const char *, q, { if (handle_getinfo_helper(q, &ans) < 0) { @@ -601,12 +600,12 @@ handle_control_getinfo(connection_t *conn, uint32_t len, const char *body) } smartlist_add(answers, tor_strdup(q)); smartlist_add(answers, ans); - msg_len += 2 + strlen(ans) + strlen(q); }); msg = smartlist_join_strings2(answers, "\0", 1, 1, &msg_len); + tor_assert(msg_len > 0); /* it will at least be terminated */ send_control_message(conn, CONTROL_CMD_INFOVALUE, - msg_len, msg_len?msg:NULL); + msg_len, msg); done: if (answers) SMARTLIST_FOREACH(answers, char *, cp, tor_free(cp)); |