Browse Source

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
Peter Palfrader 17 years ago
parent
commit
8987bd2fd9
1 changed files with 2 additions and 0 deletions
  1. 2 0
      src/or/control.c

+ 2 - 0
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;
     }