Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 70f74b79 authored by Christian Gustafsson's avatar Christian Gustafsson Committed by Wink Saville
Browse files

Assemble WAP datagram correctly when segments arrive out of order

The WAP assembly code will always attach the last received segment at the end
of the WAP datagram. Change the code to add the current segment at the correct
location during the WAP datagram assembly.

Change-Id: I4cc18bf33bc68ab9a328a0107f21e3670b5026ac
parent 04b2868c
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -299,13 +299,15 @@ final class CdmaSMSDispatcher extends SMSDispatcher {

        // Build up the data stream
        ByteArrayOutputStream output = new ByteArrayOutputStream();
        for (int i = 0; i < totalSegments-1; i++) {
        for (int i = 0; i < totalSegments; i++) {
            // reassemble the (WSP-)pdu
            output.write(pdus[i], 0, pdus[i].length);
        }

            if (i == segment) {
                // This one isn't in the DB, so add it
                output.write(pdu, index, pdu.length - index);
            } else {
                output.write(pdus[i], 0, pdus[i].length);
            }
        }

        byte[] datagram = output.toByteArray();
        // Dispatch the PDU to applications