Commit 397f366
bugfix: ngx.req.set_header: skips setting multi-value headers for bad requests to avoid segfaults.
When setting a multi-value header during bad requests, the value isn't
added into the header's array. Despite failing to be set, the size of the
array is still incremented. Later, if Nginx attempts to iterate over the
array, a segfault will occur.
e21d9b5 established a pattern of silently ignoring the header being set.
I've moved the check for a bad request into `ngx_http_lua_set_input_header`
so that setting a header value is ignored for both types of headers.
Signed-off-by: Yichun Zhang (agentzh) <agentzh@gmail.com>1 parent 37e5362 commit 397f366
2 files changed
+27
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | 266 | | |
272 | 267 | | |
273 | 268 | | |
| |||
698 | 693 | | |
699 | 694 | | |
700 | 695 | | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
701 | 701 | | |
702 | 702 | | |
703 | 703 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
1622 | 1622 | | |
1623 | 1623 | | |
1624 | 1624 | | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
| 1631 | + | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
| 1636 | + | |
| 1637 | + | |
| 1638 | + | |
| 1639 | + | |
| 1640 | + | |
| 1641 | + | |
| 1642 | + | |
| 1643 | + | |
| 1644 | + | |
| 1645 | + | |
0 commit comments