Commit 4aa96d6
authored
Fix OOB read/write in interopserver POST filename parsing (#6055)
## Description
## Summary
- `HttpRequest::ReceiveUniDiData` called `strstr(FileName, "\r\n")` on a
raw `QUIC_BUFFER` from
`Event->RECEIVE.Buffers`, which is not NUL-terminated. A peer sending
`POST ` followed by non-CRLF bytes with no NUL
byte in the first delivered buffer caused `strstr` to walk past
`FirstBuffer->Buffer + FirstBuffer->Length` into
adjacent memory, and the subsequent `*FileNameEnd = '\0'` wrote a NUL
byte outside the receive buffer
- Replaced `strstr` with a bounded scan limited to `FirstBuffer->Length
- 5`, and copy the filename into a local
NUL-terminated buffer instead of mutating the receive buffer. Also added
an explicit length cap so the filename can't
silently truncate inside the later `snprintf`.
## Testing
NA
## Documentation
NA1 parent 1c98961 commit 4aa96d6
2 files changed
Lines changed: 12 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| |||
313 | 315 | | |
314 | 316 | | |
315 | 317 | | |
316 | | - | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
317 | 324 | | |
318 | 325 | | |
319 | 326 | | |
320 | 327 | | |
321 | 328 | | |
322 | | - | |
| 329 | + | |
323 | 330 | | |
324 | 331 | | |
325 | 332 | | |
| |||
339 | 346 | | |
340 | 347 | | |
341 | 348 | | |
342 | | - | |
343 | | - | |
| 349 | + | |
344 | 350 | | |
345 | 351 | | |
346 | 352 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| |||
0 commit comments