From 8987bd2fd9f62b6ed4db6896f4f9758bb6f9634c Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Mon, 10 Mar 2008 12:13:43 +0000 Subject: [PATCH] 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 --- src/or/control.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/or/control.c b/src/or/control.c index 3cc9c5fe2f..c2337e9830 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -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; }