mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-11 05:03:34 +01:00
Merge branch 'maint-0.3.1'
This commit is contained in:
commit
ad3f0953e6
5
changes/bug22644
Normal file
5
changes/bug22644
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
o Minor bugfixes (controller):
|
||||||
|
- Do not crash when receiving a POSTDESCRIPTOR command with an
|
||||||
|
empty body. Fixes part of bug 22644; bugfix on 0.2.0.1-alpha.
|
||||||
|
- Do not crash when receiving a HSPOST command with an empty body.
|
||||||
|
Fixes part of bug 22644; bugfix on 0.2.7.1-alpha.
|
@ -3633,12 +3633,15 @@ handle_control_postdescriptor(control_connection_t *conn, uint32_t len,
|
|||||||
int cache = 0; /* eventually, we may switch this to 1 */
|
int cache = 0; /* eventually, we may switch this to 1 */
|
||||||
|
|
||||||
const char *cp = memchr(body, '\n', len);
|
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;
|
++cp;
|
||||||
|
|
||||||
char *cmdline = tor_memdup_nulterm(body, cp-body);
|
char *cmdline = tor_memdup_nulterm(body, cp-body);
|
||||||
|
smartlist_t *args = smartlist_new();
|
||||||
smartlist_split_string(args, cmdline, " ",
|
smartlist_split_string(args, cmdline, " ",
|
||||||
SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, 0);
|
SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, 0);
|
||||||
SMARTLIST_FOREACH_BEGIN(args, char *, option) {
|
SMARTLIST_FOREACH_BEGIN(args, char *, option) {
|
||||||
@ -4231,14 +4234,19 @@ handle_control_hspost(control_connection_t *conn,
|
|||||||
const char *body)
|
const char *body)
|
||||||
{
|
{
|
||||||
static const char *opt_server = "SERVER=";
|
static const char *opt_server = "SERVER=";
|
||||||
smartlist_t *args = smartlist_new();
|
|
||||||
smartlist_t *hs_dirs = NULL;
|
smartlist_t *hs_dirs = NULL;
|
||||||
const char *encoded_desc = body;
|
const char *encoded_desc = body;
|
||||||
size_t encoded_desc_len = len;
|
size_t encoded_desc_len = len;
|
||||||
|
|
||||||
char *cp = memchr(body, '\n', 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);
|
char *argline = tor_strndup(body, cp-body);
|
||||||
|
|
||||||
|
smartlist_t *args = smartlist_new();
|
||||||
|
|
||||||
/* If any SERVER= options were specified, try parse the options line */
|
/* If any SERVER= options were specified, try parse the options line */
|
||||||
if (!strcasecmpstart(argline, opt_server)) {
|
if (!strcasecmpstart(argline, opt_server)) {
|
||||||
/* encoded_desc begins after a newline character */
|
/* encoded_desc begins after a newline character */
|
||||||
|
Loading…
Reference in New Issue
Block a user