[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] fix a memory-squashing bug that was causing an infinite loop
- To: or-cvs@freehaven.net
- Subject: [or-cvs] fix a memory-squashing bug that was causing an infinite loop
- From: arma@seul.org (Roger Dingledine)
- Date: Tue, 9 Nov 2004 05:08:44 -0500 (EST)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Tue, 09 Nov 2004 05:09:03 -0500
- Reply-to: or-dev@freehaven.net
- Sender: owner-or-cvs@freehaven.net
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;