summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-04-23 09:50:29 -0400
committerNick Mathewson <nickm@torproject.org>2015-04-23 09:50:29 -0400
commit372aef8981f383db8962fbbe67f4d18b56d3740d (patch)
treeedc344748b1090ef8a259fc50b680da3a010d53a /src
parentc3894473fee0199de50904973abb75fe2935451f (diff)
parentd59c4063f393774c2c4328061b1e47c7dbb0250c (diff)
downloadtor-372aef8981f383db8962fbbe67f4d18b56d3740d.tar.gz
tor-372aef8981f383db8962fbbe67f4d18b56d3740d.zip
Merge remote-tracking branch 'public/bug15546'
Diffstat (limited to 'src')
-rw-r--r--src/or/control.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/or/control.c b/src/or/control.c
index 547145bbe9..b2706bc18a 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -2795,12 +2795,14 @@ handle_control_postdescriptor(control_connection_t *conn, uint32_t len,
uint8_t purpose = ROUTER_PURPOSE_GENERAL;
int cache = 0; /* eventually, we may switch this to 1 */
- char *cp = memchr(body, '\n', len);
+ const char *cp = memchr(body, '\n', len);
smartlist_t *args = smartlist_new();
tor_assert(cp);
- *cp++ = '\0';
+ ++cp;
- smartlist_split_string(args, body, " ",
+ char *cmdline = tor_memdup_nulterm(body, cp-body);
+
+ smartlist_split_string(args, cmdline, " ",
SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, 0);
SMARTLIST_FOREACH_BEGIN(args, char *, option) {
if (!strcasecmpstart(option, "purpose=")) {
@@ -2849,6 +2851,7 @@ handle_control_postdescriptor(control_connection_t *conn, uint32_t len,
done:
SMARTLIST_FOREACH(args, char *, arg, tor_free(arg));
smartlist_free(args);
+ tor_free(cmdline);
return 0;
}