Commit 05a7711
committed
http: do not search outside the header value
Header values in picohttp are not null-terminated so `strstr` would
happily search outside the header value and exceed the length of the
header value.
This could lead to DoS in artifical circumstances which don't apply to
fd in practice. There is always a null byte in memory _somewhere_ after
the header value even if it is not actually part of the header value.
This is because `fd_http_server_ws_frame`s are allocated after the
request buffer that contains the headers and the ws_frames contain
four bytes of padding that is zero, because the whole memory we're
operating on, has been allocated with `mmap` anonymously which
zeroes the memory QED.1 parent 3be8509 commit 05a7711
1 file changed
+3
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
581 | 581 | | |
582 | 582 | | |
583 | 583 | | |
584 | | - | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
585 | 587 | | |
586 | 588 | | |
587 | 589 | | |
| |||
0 commit comments