mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-07-18 02:52:14 +01:00
Improve too-long message body checks
Co-authored-by: trevor-signal <131492920+trevor-signal@users.noreply.github.com>
This commit is contained in:
@@ -2095,6 +2095,7 @@ export default class MessageReceiver
|
||||
const length = Buffer.byteLength(message.body);
|
||||
this.#removeFromCache(envelope);
|
||||
log.warn(`${logId}: Dropping too-long message. Length: ${length}`);
|
||||
return;
|
||||
}
|
||||
|
||||
strictAssert(timestamp, 'Missing sent timestamp');
|
||||
@@ -2381,6 +2382,13 @@ export default class MessageReceiver
|
||||
'MessageReceiver.handleEditMesage: received message from PNI'
|
||||
);
|
||||
|
||||
if (message.body && isBodyTooLong(message.body)) {
|
||||
const length = Buffer.byteLength(message.body);
|
||||
this.#removeFromCache(envelope);
|
||||
log.warn(`${logId}: Dropping too-long message. Length: ${length}`);
|
||||
return;
|
||||
}
|
||||
|
||||
const ev = new MessageEvent(
|
||||
{
|
||||
envelopeId: envelope.id,
|
||||
@@ -2496,6 +2504,7 @@ export default class MessageReceiver
|
||||
const length = Buffer.byteLength(message.body);
|
||||
this.#removeFromCache(envelope);
|
||||
log.warn(`${logId}: Dropping too-long message. Length: ${length}`);
|
||||
return;
|
||||
}
|
||||
|
||||
const ev = new MessageEvent(
|
||||
@@ -3160,6 +3169,13 @@ export default class MessageReceiver
|
||||
|
||||
const message = this.#processDecrypted(envelope, editMessage.dataMessage);
|
||||
|
||||
if (message.body && isBodyTooLong(message.body)) {
|
||||
const length = Buffer.byteLength(message.body);
|
||||
this.#removeFromCache(envelope);
|
||||
log.warn(`${logId}: Dropping too-long message. Length: ${length}`);
|
||||
return;
|
||||
}
|
||||
|
||||
const ev = new SentEvent(
|
||||
{
|
||||
envelopeId: envelope.id,
|
||||
|
||||
Reference in New Issue
Block a user