[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] stop a potential overflow (pointed out by ilja)



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

Modified Files:
	relay.c 
Log Message:
stop a potential overflow (pointed out by ilja)


Index: relay.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/relay.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- relay.c	22 Feb 2005 00:53:08 -0000	1.39
+++ relay.c	24 Feb 2005 10:22:00 -0000	1.40
@@ -436,8 +436,10 @@
     rh.stream_id = fromconn->stream_id; /* else it's 0 */
   rh.length = payload_len;
   relay_header_pack(cell.payload, &rh);
-  if (payload_len)
+  if (payload_len) {
+    tor_assert(payload_len <= RELAY_PAYLOAD_SIZE);
     memcpy(cell.payload+RELAY_HEADER_SIZE, payload, payload_len);
+  }
 
   log_fn(LOG_DEBUG,"delivering %d cell %s.", relay_command,
          cell_direction == CELL_DIRECTION_OUT ? "forward" : "backward");