Loading src/or/control.c +16 −3 Original line number Diff line number Diff line Loading @@ -1756,7 +1756,7 @@ handle_control_postdescriptor(connection_t *conn, uint32_t len, } /** Called when we receive a REDIRECTSTERAM command. Try to change the target * adderess of the named AP steream, and report success or failure. */ * address of the named AP stream, and report success or failure. */ static int handle_control_redirectstream(connection_t *conn, uint32_t len, const char *body) Loading @@ -1764,6 +1764,7 @@ handle_control_redirectstream(connection_t *conn, uint32_t len, connection_t *ap_conn = NULL; uint32_t conn_id; char *new_addr = NULL; uint16_t new_port = 0; if (STATE_IS_V0(conn->state)) { if (len < 6) { send_control0_error(conn, ERR_SYNTAX, "redirectstream message too short"); Loading @@ -1790,9 +1791,19 @@ handle_control_redirectstream(connection_t *conn, uint32_t len, || !ap_conn->socks_request) { connection_printf_to_buf(conn, "552 Unknown stream \"%s\"\r\n", (char*)smartlist_get(args, 0)); } else { int ok; if (smartlist_len(args) < 3) { /* they included a port too */ new_port = (uint16_t) tor_parse_ulong(smartlist_get(args, 2), 10, 1, 65535, &ok, NULL); } if (!ok) { connection_printf_to_buf(conn, "512 Cannot parse port \"%s\"\r\n", (char*)smartlist_get(args, 2)); } else { new_addr = tor_strdup(smartlist_get(args, 1)); } } SMARTLIST_FOREACH(args, char *, cp, tor_free(cp)); smartlist_free(args); Loading @@ -1802,6 +1813,8 @@ handle_control_redirectstream(connection_t *conn, uint32_t len, strlcpy(ap_conn->socks_request->address, new_addr, sizeof(ap_conn->socks_request->address)); if (new_port) ap_conn->socks_request->port = new_port; tor_free(new_addr); send_control_done(conn); return 0; Loading Loading
src/or/control.c +16 −3 Original line number Diff line number Diff line Loading @@ -1756,7 +1756,7 @@ handle_control_postdescriptor(connection_t *conn, uint32_t len, } /** Called when we receive a REDIRECTSTERAM command. Try to change the target * adderess of the named AP steream, and report success or failure. */ * address of the named AP stream, and report success or failure. */ static int handle_control_redirectstream(connection_t *conn, uint32_t len, const char *body) Loading @@ -1764,6 +1764,7 @@ handle_control_redirectstream(connection_t *conn, uint32_t len, connection_t *ap_conn = NULL; uint32_t conn_id; char *new_addr = NULL; uint16_t new_port = 0; if (STATE_IS_V0(conn->state)) { if (len < 6) { send_control0_error(conn, ERR_SYNTAX, "redirectstream message too short"); Loading @@ -1790,9 +1791,19 @@ handle_control_redirectstream(connection_t *conn, uint32_t len, || !ap_conn->socks_request) { connection_printf_to_buf(conn, "552 Unknown stream \"%s\"\r\n", (char*)smartlist_get(args, 0)); } else { int ok; if (smartlist_len(args) < 3) { /* they included a port too */ new_port = (uint16_t) tor_parse_ulong(smartlist_get(args, 2), 10, 1, 65535, &ok, NULL); } if (!ok) { connection_printf_to_buf(conn, "512 Cannot parse port \"%s\"\r\n", (char*)smartlist_get(args, 2)); } else { new_addr = tor_strdup(smartlist_get(args, 1)); } } SMARTLIST_FOREACH(args, char *, cp, tor_free(cp)); smartlist_free(args); Loading @@ -1802,6 +1813,8 @@ handle_control_redirectstream(connection_t *conn, uint32_t len, strlcpy(ap_conn->socks_request->address, new_addr, sizeof(ap_conn->socks_request->address)); if (new_port) ap_conn->socks_request->port = new_port; tor_free(new_addr); send_control_done(conn); return 0; Loading