Commit 53f4fbb
committed
Add integer overflow checks to URL escape allocation functions
ap_escape_path_segment, ap_os_escape_path, and ap_escape_urlencoded
allocate output buffers using 3 * strlen(input) + constant without
checking for overflow. On platforms where size_t is 32-bit, large
inputs cause the multiplication to wrap, resulting in undersized
allocation.
The HTML escape function ap_escape_html2 in the same file already
has overflow protection (abort on overflow). Apply the same pattern
to the three URL escape functions for consistency.1 parent 3b3af44 commit 53f4fbb
1 file changed
+21
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2073 | 2073 | | |
2074 | 2074 | | |
2075 | 2075 | | |
2076 | | - | |
| 2076 | + | |
| 2077 | + | |
| 2078 | + | |
| 2079 | + | |
| 2080 | + | |
2077 | 2081 | | |
2078 | 2082 | | |
2079 | 2083 | | |
| |||
2082 | 2086 | | |
2083 | 2087 | | |
2084 | 2088 | | |
2085 | | - | |
2086 | | - | |
2087 | | - | |
| 2089 | + | |
| 2090 | + | |
| 2091 | + | |
| 2092 | + | |
2088 | 2093 | | |
2089 | 2094 | | |
| 2095 | + | |
| 2096 | + | |
| 2097 | + | |
| 2098 | + | |
| 2099 | + | |
| 2100 | + | |
| 2101 | + | |
2090 | 2102 | | |
2091 | 2103 | | |
2092 | 2104 | | |
| |||
2133 | 2145 | | |
2134 | 2146 | | |
2135 | 2147 | | |
2136 | | - | |
| 2148 | + | |
| 2149 | + | |
| 2150 | + | |
| 2151 | + | |
| 2152 | + | |
2137 | 2153 | | |
2138 | 2154 | | |
2139 | 2155 | | |
| |||
0 commit comments