mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 02:39:05 +01:00
Don't accept an unreasonably large window size.
This commit is contained in:
@@ -11,11 +11,11 @@ import java.util.logging.Logger;
|
||||
|
||||
class Receiver implements ReadHandler {
|
||||
|
||||
static final int MAX_WINDOW_SIZE = 8 * Data.MAX_PAYLOAD_LENGTH;
|
||||
|
||||
private static final Logger LOG =
|
||||
Logger.getLogger(Receiver.class.getName());
|
||||
|
||||
private static final int MAX_WINDOW_SIZE = 8 * Data.MAX_PAYLOAD_LENGTH;
|
||||
|
||||
private final Sender sender;
|
||||
private final SortedSet<Data> dataFrames; // Locking: this
|
||||
|
||||
|
||||
@@ -106,7 +106,8 @@ class Sender {
|
||||
// Update the window
|
||||
lastWindowUpdateOrProbe = now;
|
||||
int oldWindowSize = windowSize;
|
||||
windowSize = a.getWindowSize();
|
||||
// Don't accept an unreasonably large window size
|
||||
windowSize = Math.min(a.getWindowSize(), Receiver.MAX_WINDOW_SIZE);
|
||||
if(LOG.isLoggable(FINE)) LOG.fine("Window at sender " + windowSize);
|
||||
// If space has become available, notify any waiting writers
|
||||
if(windowSize > oldWindowSize || foundIndex != -1) notifyAll();
|
||||
|
||||
Reference in New Issue
Block a user