[or-cvs] r13939: If we decrement incoming_cmd's length when receiving the end (tor/trunk/src/or)

weasel at seul.org weasel at seul.org
Mon Mar 10 12:13:43 UTC 2008


Author: weasel
Date: 2008-03-10 08:13:43 -0400 (Mon, 10 Mar 2008)
New Revision: 13939

Modified:
   tor/trunk/src/or/control.c
Log:
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.

Modified: tor/trunk/src/or/control.c
===================================================================
--- tor/trunk/src/or/control.c	2008-03-10 12:02:27 UTC (rev 13938)
+++ tor/trunk/src/or/control.c	2008-03-10 12:13:43 UTC (rev 13939)
@@ -2742,11 +2742,13 @@
     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;
     }



More information about the tor-commits mailing list