Commit 2bf4601
committed
Fetch: fixed heap buffer overflow in proxy URL credentials.
The destination buffers for the decoded user and password in
ngx_js_parse_proxy_url() were a fixed 128 bytes, while the encoded
input length was bounded only by the URL length. Since
ngx_unescape_uri() writes at most one byte per input byte, raw
credentials longer than 128 bytes overflowed the buffer; the
length check ran only after the decode.
The fix is to size the destination buffer based on the encoded
input length.
The bug appeared in dea8318 (0.9.4).1 parent 0ffc96d commit 2bf4601
2 files changed
Lines changed: 18 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3549 | 3549 | | |
3550 | 3550 | | |
3551 | 3551 | | |
3552 | | - | |
| 3552 | + | |
3553 | 3553 | | |
3554 | 3554 | | |
3555 | 3555 | | |
3556 | 3556 | | |
3557 | | - | |
| 3557 | + | |
3558 | 3558 | | |
3559 | 3559 | | |
3560 | 3560 | | |
3561 | 3561 | | |
3562 | 3562 | | |
3563 | 3563 | | |
3564 | 3564 | | |
3565 | | - | |
3566 | 3565 | | |
3567 | | - | |
| 3566 | + | |
| 3567 | + | |
3568 | 3568 | | |
3569 | | - | |
3570 | | - | |
| 3569 | + | |
3571 | 3570 | | |
3572 | 3571 | | |
3573 | 3572 | | |
3574 | 3573 | | |
3575 | 3574 | | |
3576 | 3575 | | |
3577 | | - | |
3578 | 3576 | | |
3579 | | - | |
| 3577 | + | |
| 3578 | + | |
3580 | 3579 | | |
3581 | | - | |
3582 | | - | |
| 3580 | + | |
3583 | 3581 | | |
3584 | 3582 | | |
3585 | 3583 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
62 | 68 | | |
63 | 69 | | |
64 | 70 | | |
| |||
128 | 134 | | |
129 | 135 | | |
130 | 136 | | |
131 | | - | |
| 137 | + | |
132 | 138 | | |
133 | 139 | | |
134 | 140 | | |
| |||
138 | 144 | | |
139 | 145 | | |
140 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
141 | 150 | | |
142 | 151 | | |
0 commit comments