diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-09-08 08:24:36 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-09-08 08:24:36 -0400 |
commit | 3cace828a9b42c62a73d1e3b79161a7f68aca40e (patch) | |
tree | 2b6c9520a855ea281139ada501b81ec45d0b0245 /src | |
parent | 08592c95fa30703beee7b65cc5bdb8923cbe4bcb (diff) | |
parent | 12dad5ebf798232111919d5498f522d5b3f146a5 (diff) | |
download | tor-3cace828a9b42c62a73d1e3b79161a7f68aca40e.tar.gz tor-3cace828a9b42c62a73d1e3b79161a7f68aca40e.zip |
Merge branch 'bug22644_029' into maint-0.2.9
Diffstat (limited to 'src')
-rw-r--r-- | src/or/control.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/or/control.c b/src/or/control.c index 1bf1e33bbc..03d9fcee2a 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -3568,12 +3568,15 @@ handle_control_postdescriptor(control_connection_t *conn, uint32_t len, int cache = 0; /* eventually, we may switch this to 1 */ const char *cp = memchr(body, '\n', len); - smartlist_t *args = smartlist_new(); - tor_assert(cp); + + if (cp == NULL) { + connection_printf_to_buf(conn, "251 Empty body\r\n"); + return 0; + } ++cp; char *cmdline = tor_memdup_nulterm(body, cp-body); - + smartlist_t *args = smartlist_new(); smartlist_split_string(args, cmdline, " ", SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, 0); SMARTLIST_FOREACH_BEGIN(args, char *, option) { @@ -4158,14 +4161,19 @@ handle_control_hspost(control_connection_t *conn, const char *body) { static const char *opt_server = "SERVER="; - smartlist_t *args = smartlist_new(); smartlist_t *hs_dirs = NULL; const char *encoded_desc = body; size_t encoded_desc_len = len; char *cp = memchr(body, '\n', len); + if (cp == NULL) { + connection_printf_to_buf(conn, "251 Empty body\r\n"); + return 0; + } char *argline = tor_strndup(body, cp-body); + smartlist_t *args = smartlist_new(); + /* If any SERVER= options were specified, try parse the options line */ if (!strcasecmpstart(argline, opt_server)) { /* encoded_desc begins after a newline character */ |