I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 1c4b0335 authored by zzz's avatar zzz
Browse files

move error check to a better place

parent 50606a68
No related branches found
No related tags found
No related merge requests found
......@@ -238,10 +238,7 @@ class PacketBuilder {
packet.release();
return null;
}
if (dataSize == 0) {
// OK according to the protocol but if we send it, it's a bug
_log.error("Sending zero-size fragment " + fragment + " of " + state + " for " + peer);
}
int currentMTU = peer.getMTU();
int availableForAcks = currentMTU - MIN_DATA_PACKET_OVERHEAD - dataSize;
int availableForExplicitAcks = availableForAcks;
......@@ -382,6 +379,11 @@ class PacketBuilder {
// _log.debug("Size written: " + sizeWritten + " for fragment " + fragment
// + " of " + state.getMessageId());
}
// put this after writeFragment() since dataSize will be zero for use-after-free
if (dataSize == 0) {
// OK according to the protocol but if we send it, it's a bug
_log.error("Sending zero-size fragment " + fragment + " of " + state + " for " + peer);
}
off += dataSize;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment