mirror of
https://github.com/oxen-io/session-android.git
synced 2025-08-25 13:57:39 +00:00
Enforce max envelope size in more places.
This commit is contained in:

committed by
Cody Henthorne

parent
0068d62122
commit
f4c1e34402
@@ -701,13 +701,7 @@ public class SignalServiceMessageSender {
|
||||
|
||||
builder.setTimestamp(message.getTimestamp());
|
||||
|
||||
byte[] content = container.setDataMessage(builder).build().toByteArray();
|
||||
|
||||
if (maxEnvelopeSize > 0 && content.length > maxEnvelopeSize) {
|
||||
throw new ContentTooLargeException(content.length);
|
||||
}
|
||||
|
||||
return content;
|
||||
return enforceMaxContentSize(container.setDataMessage(builder).build().toByteArray());
|
||||
}
|
||||
|
||||
private byte[] createCallContent(SignalServiceCallMessage callMessage) {
|
||||
@@ -1261,6 +1255,8 @@ public class SignalServiceMessageSender {
|
||||
CancelationSignal cancelationSignal)
|
||||
throws IOException
|
||||
{
|
||||
enforceMaxContentSize(content);
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
List<Future<SendMessageResult>> futureResults = new LinkedList<>();
|
||||
Iterator<SignalServiceAddress> recipientIterator = recipients.iterator();
|
||||
@@ -1325,6 +1321,8 @@ public class SignalServiceMessageSender {
|
||||
CancelationSignal cancelationSignal)
|
||||
throws UntrustedIdentityException, IOException
|
||||
{
|
||||
enforceMaxContentSize(content);
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
for (int i = 0; i < RETRY_COUNT; i++) {
|
||||
@@ -1591,6 +1589,13 @@ public class SignalServiceMessageSender {
|
||||
return results;
|
||||
}
|
||||
|
||||
private byte[] enforceMaxContentSize(byte[] content) {
|
||||
if (maxEnvelopeSize > 0 && content.length > maxEnvelopeSize) {
|
||||
throw new ContentTooLargeException(content.length);
|
||||
}
|
||||
return content;
|
||||
}
|
||||
|
||||
public static interface EventListener {
|
||||
public void onSecurityEvent(SignalServiceAddress address);
|
||||
}
|
||||
|
Reference in New Issue
Block a user