浏览代码

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 年之前
父节点
当前提交
8987bd2fd9
共有 1 个文件被更改,包括 2 次插入0 次删除
  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;
     }