Commit 6c3c80a
authored
Merge commit from fork
Bound both the Vec allocation and loop iteration count by the remaining
packet data when parsing SSH_MSG_USERAUTH_INFO_RESPONSE. Previously, the
response count was read as a u32 from the client and passed directly to
Vec::with_capacity(), allowing a malicious client to trigger a multi-GB
allocation with a single small packet, crashing the server via OOM.
The fix caps the count to the maximum number of responses that could
fit in the remaining packet data (each needs at least 4 bytes for a
length prefix), bounding allocation to at most the packet size (~256KB).1 parent a9057ed commit 6c3c80a
1 file changed
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
522 | 522 | | |
523 | 523 | | |
524 | 524 | | |
525 | | - | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
526 | 532 | | |
527 | 533 | | |
528 | 534 | | |
| |||
0 commit comments