[or-cvs] fix a memory-squashing bug that was causing an infinite loop

Roger Dingledine arma at seul.org
Tue Nov 9 10:08:44 UTC 2004


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or

Modified Files:
	control.c 
Log Message:
fix a memory-squashing bug that was causing an infinite loop


Index: control.c
===================================================================
RCS file: /home/or/cvsroot/src/or/control.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- control.c	9 Nov 2004 07:55:48 -0000	1.18
+++ control.c	9 Nov 2004 10:08:42 -0000	1.19
@@ -146,10 +146,10 @@
 {
   char buf[4];
   tor_assert(conn);
-  tor_assert(len || !body || !strlen(body));
+  tor_assert(len || !body);
   tor_assert(type <= _CONTROL_CMD_MAX_RECOGNIZED);
-  set_uint32(buf, htons(len));
-  set_uint32(buf+2, htons(type));
+  set_uint16(buf, htons(len));
+  set_uint16(buf+2, htons(type));
   connection_write_to_buf(buf, 4, conn);
   if (len)
     connection_write_to_buf(body, len, conn);
@@ -544,7 +544,7 @@
     return 0;
 
   set_uint32(buf, htonl(n_read));
-  set_uint32(buf+4, htonl(n_read));
+  set_uint32(buf+4, htonl(n_written));
   send_control_event(EVENT_BANDWIDTH_USED, 8, buf);
 
   return 0;



More information about the tor-commits mailing list