Commit 5b3b2838 authored by Robert Ricci's avatar Robert Ricci
Browse files

Serious bugfix - PakcetInfo::census() was undercounting the number

of bytes required to save the packet. This was causing us to create
a buffer too small to hold the packet, causing memory corruption bugs
and causing us to write invalid replay files.

The way that the packet size claculation is separated from the saving
of the packet is a serious problem, and needs to be re-designed!
parent 4820df1b
......@@ -195,13 +195,15 @@ struct PacketInfo
{
size_t census(void)
{
// packetTime+packetLength+kernel+elab
size_t result = sizeof(int)*(2 +1 +21 + 1) +
sizeof(short)*(0 +0 +0 + 2) +
sizeof(char)*(0 +0 +7 + 1) +
// packetTime+packetLength
size_t result = sizeof(int)*(2 +1 ) +
sizeof(short)*(0 +0 ) +
sizeof(char)*(0 +0 ) +
sizeof(struct tcp_info) +
sizeof(struct ip) + sizeof(struct tcphdr)
+ sizeof(unsigned char) /* bufferFull */
+ sizeof(unsigned char) /* packetType */;
+ sizeof(unsigned char) /* packetType */
+ sizeof(struct Order); /* elab */
// Size for ipOptions and tcpOptions.
result += sizeof(unsigned int)*2;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment