Fix padding problem.

This commit is contained in:
Moxie Marlinspike 2014-07-23 00:59:54 -07:00
parent c94a7b1eff
commit 82bd75fb75

View File

@ -32,7 +32,7 @@ public class PushTransportDetails implements TransportDetails {
@Override @Override
public byte[] getStrippedPaddingMessageBody(byte[] messageWithPadding) { public byte[] getStrippedPaddingMessageBody(byte[] messageWithPadding) {
if (messageVersion < 2) throw new AssertionError("Unknown version: " + messageVersion); if (messageVersion < 2) throw new AssertionError("Unknown version: " + messageVersion);
else if (messageVersion == 2) return messageWithPadding; else if (messageVersion == 2) return messageWithPadding;
int paddingStart = 0; int paddingStart = 0;
@ -47,7 +47,7 @@ public class PushTransportDetails implements TransportDetails {
} }
} }
byte[] strippedMessage = new byte[messageWithPadding.length - paddingStart]; byte[] strippedMessage = new byte[paddingStart];
System.arraycopy(messageWithPadding, 0, strippedMessage, 0, strippedMessage.length); System.arraycopy(messageWithPadding, 0, strippedMessage, 0, strippedMessage.length);
return strippedMessage; return strippedMessage;