Menu

#73 SMPPPacket.writeTo(os,optionals) writes wrong message size

0.3.10
open
Network (10)
7
2013-11-22
2010-10-15
Axel
No

If a Connection is using version 3.4 and is in 'notSupportingOptionalValues' mode (bind response did not have version parameter) the current implemenation of SMPPPacket.writeTo(OutputStream,boolean) is dead wrong, because it sends a message which contains a invalid message size.

With out current provider this causes connection drops!

Assuming that 'withOptional' is false:

public final void writeTo(OutputStream out, boolean withOptional)
        throws java.io.IOException {

this calculates the full length including TLV table !!!
int commandLen = getLength();

this sends the full length
SMPPIO.writeInt(commandLen, 4, out);
SMPPIO.writeInt(commandId, 4, out);
SMPPIO.writeInt(commandStatus, 4, out);
SMPPIO.writeInt(sequenceNum, 4, out);

    encodeBody(out);

but here we just don't send the data -> server crashes or fills with data from next message!!!
if (withOptional) {
tlvTable.writeTo(out);
}

}

I think it's obvious.

Cheers,
Axel.

Discussion

  • Oran Kelly

    Oran Kelly - 2010-10-15

    Will fix asap.

     
  • Oran Kelly

    Oran Kelly - 2010-10-15

    Fix committed to SVN.

     
MongoDB Logo MongoDB