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:
Peter Palfrader 2008-03-10 12:13:43 +00:00
parent 0c56c7201f
commit 8987bd2fd9

View File

@ -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;
}