Pārlūkot izejas kodu

fix a seg fault with autodetecting which controller version is being used

svn:r4531
Roger Dingledine 19 gadi atpakaļ
vecāks
revīzija
8f9790a023
2 mainītis faili ar 3 papildinājumiem un 3 dzēšanām
  1. 1 1
      src/or/buffers.c
  2. 2 2
      src/or/control.c

+ 1 - 1
src/or/buffers.c

@@ -1082,7 +1082,7 @@ fetch_from_buf_socks(buf_t *buf, socks_request_t *req)
 
 #define CONTROL_CMD_FRAGMENTHEADER 0x0010
 #define CONTROL_CMD_FRAGMENT       0x0011
-/** If there is a complete version 0control message waiting on buf, then store
+/** If there is a complete version 0 control message waiting on buf, then store
  * its contents into *<b>type_out</b>, store its body's length into
  * *<b>len_out</b>, allocate and store a string for its body into
  * *<b>body_out</b>, and return 1.  (body_out will always be NUL-terminated,

+ 2 - 2
src/or/control.c

@@ -1948,7 +1948,7 @@ connection_control_process_inbuf_v0(connection_t *conn)
 {
   uint32_t body_len;
   uint16_t command_type;
-  char *body;
+  char *body=NULL;
 
  again:
   /* Try to suck a control message from the buffer. */
@@ -1957,7 +1957,7 @@ connection_control_process_inbuf_v0(connection_t *conn)
     {
     case -2:
       tor_free(body);
-      log_fn(LOG_INFO, "Detected v1 contol protocol on connection (fd %d)",
+      log_fn(LOG_INFO, "Detected v1 control protocol on connection (fd %d)",
              conn->s);
       conn->state = CONTROL_CONN_STATE_NEEDAUTH_V1;
       return connection_control_process_inbuf_v1(conn);