mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-11-01 07:53:26 +00:00
Merge 4d463b0ce155e8a9c85dd96c23df139c9294ed95 into 9b84b361225facd8e623f25d76f889d3dc54a879
This commit is contained in:
commit
02dbe386ae
@ -366,7 +366,19 @@ public struct BinaryProtocol {
|
||||
guard let rawSize = read16() else { return nil }
|
||||
originalSize = Int(rawSize)
|
||||
}
|
||||
guard originalSize >= 0 && originalSize <= FileTransferLimits.maxFramedFileBytes else { return nil }
|
||||
// Logged, not silent: this is the sibling of the ratio
|
||||
// rejection below and drops the packet just as completely, but
|
||||
// returning `nil` bare left no trace anywhere. A peer whose
|
||||
// ceiling is higher than ours (issue #1618: Android permits a
|
||||
// 10 MiB expanded payload against our ~1.13 MiB) then looks to
|
||||
// both sides like a message that simply never arrived.
|
||||
guard originalSize >= 0 && originalSize <= FileTransferLimits.maxFramedFileBytes else {
|
||||
SecureLogger.warning(
|
||||
"🚫 Declared expanded payload \(originalSize) B exceeds the \(FileTransferLimits.maxFramedFileBytes) B ceiling",
|
||||
category: .security
|
||||
)
|
||||
return nil
|
||||
}
|
||||
let compressedSize = payloadLength - lengthFieldBytes
|
||||
guard compressedSize > 0, let compressed = readData(compressedSize) else { return nil }
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user