Skip to content

Commit 75ab378

Browse files
committed
internal: keep input past a packet in DoReceive
GetInputLine() reads up to 255 bytes for the version line, so a peer that sends its first packets in the same segment leaves them buffered behind it. DoReceive() force-freed the input buffer after each packet, dropping any of those bytes past the first packet. It now keeps them and frees the buffer only once it is empty.
1 parent a615007 commit 75ab378

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎src/internal.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14872,7 +14872,9 @@ int DoReceive(WOLFSSH* ssh)
1487214872
ssh->inputBuffer.idx += peerMacSz;
1487314873

1487414874
WLOG(WS_LOG_DEBUG, "PR4: Shrinking input buffer");
14875-
ShrinkBuffer(&ssh->inputBuffer, 1);
14875+
/* Keep bytes past this packet; DoProtoId() can leave some. */
14876+
ShrinkBuffer(&ssh->inputBuffer,
14877+
ssh->inputBuffer.idx >= ssh->inputBuffer.length);
1487614878
ssh->processReplyState = PROCESS_INIT;
1487714879
}
1487814880

0 commit comments

Comments
 (0)