Commit b06639f
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 b2c7680 commit b06639f
1 file changed
+3
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
575 | 575 | | |
576 | 576 | | |
577 | 577 | | |
578 | | - | |
| 578 | + | |
579 | 579 | | |
580 | 580 | | |
581 | 581 | | |
582 | 582 | | |
583 | 583 | | |
584 | | - | |
| 584 | + | |
| 585 | + | |
585 | 586 | | |
586 | 587 | | |
587 | 588 | | |
| |||
0 commit comments