mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-20 02:09:24 +01:00
If we decrement incoming_cmd's length when receiving the ending CRLF "." CRLF for a multi-line control command, also truncate the string by nul-terminating it in the correct place.
svn:r13939
This commit is contained in:
parent
0c56c7201f
commit
8987bd2fd9
@ -2742,11 +2742,13 @@ connection_control_process_inbuf(control_connection_t *conn)
|
||||
if (last_idx+3 == conn->incoming_cmd_cur_len &&
|
||||
!memcmp(conn->incoming_cmd + last_idx, ".\r\n", 3)) {
|
||||
/* Just appended ".\r\n"; we're done. Remove it. */
|
||||
conn->incoming_cmd[last_idx] = '\0';
|
||||
conn->incoming_cmd_cur_len -= 3;
|
||||
break;
|
||||
} else if (last_idx+2 == conn->incoming_cmd_cur_len &&
|
||||
!memcmp(conn->incoming_cmd + last_idx, ".\n", 2)) {
|
||||
/* Just appended ".\n"; we're done. Remove it. */
|
||||
conn->incoming_cmd[last_idx] = '\0';
|
||||
conn->incoming_cmd_cur_len -= 2;
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user