Changeset 1c4b033


Ignore:
Timestamp:
Dec 9, 2011 11:01:19 PM (8 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
fc7d8f7
Parents:
50606a6
Message:

move error check to a better place

File:
1 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/transport/udp/PacketBuilder.java

    r50606a6 r1c4b033  
    239239            return null;
    240240        }
    241         if (dataSize == 0) {
    242             // OK according to the protocol but if we send it, it's a bug
    243             _log.error("Sending zero-size fragment " + fragment + " of " + state + " for " + peer);
    244         }
     241
    245242        int currentMTU = peer.getMTU();
    246243        int availableForAcks = currentMTU - MIN_DATA_PACKET_OVERHEAD - dataSize;
     
    383380        //               + " of " + state.getMessageId());
    384381        }
     382        // put this after writeFragment() since dataSize will be zero for use-after-free
     383        if (dataSize == 0) {
     384            // OK according to the protocol but if we send it, it's a bug
     385            _log.error("Sending zero-size fragment " + fragment + " of " + state + " for " + peer);
     386        }
    385387        off += dataSize;
    386388
Note: See TracChangeset for help on using the changeset viewer.