]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Add a pointless 2-byte memset in cell_pack
authorNick Mathewson <nickm@torproject.org>
Wed, 7 Nov 2012 02:24:05 +0000 (21:24 -0500)
committerNick Mathewson <nickm@torproject.org>
Wed, 7 Nov 2012 02:24:05 +0000 (21:24 -0500)
There is probably no code that can write the 2 bytes at the end of the
packed_cell_t when the cell is only a 512-byte cell, but let's not get
overconfident there.

src/or/connection_or.c

index 11d38f887043f8f587c64420582a80c61fccbdf0..0775eb5c40c77eb42b0f8c6bce81efb0b4cfc4c9 100644 (file)
@@ -361,6 +361,7 @@ cell_pack(packed_cell_t *dst, const cell_t *src, int wide_circ_ids)
   } else {
     set_uint16(dest, htons(src->circ_id));
     dest += 2;
+    memset(dest+CELL_MAX_NETWORK_SIZE-2, 0, 2); /*make sure it's clear */
   }
   set_uint8(dest, src->command);
   memcpy(dest+1, src->payload, CELL_PAYLOAD_SIZE);