Commit 57fff48
committed
Fix multiple security and code quality issues
This commit addresses 13 issues identified in code review:
Critical Issues Fixed:
- Fix NULL pointer dereference in https_resp_cb by checking NULL before use
- Fix NULL pointer dereference in hostname_from_url by validating curl_url_get result
- Fix buffer overflow in addr_list_reduced by validating IP address length
- Fix incorrect fallthrough in https_set_request_version switch statement
- Fix potential integer underflow in dns_poll_cb snprintf calculation
- Add validation for DNS request sizes from network to prevent DoS attacks
- Fix potential memory leak in https_fetch_ctx_init error path
- Fix NULL pointer dereference risk in ring_buffer_free
Medium Priority Issues Fixed:
- Fix signed/unsigned loop logic in dns_server_tcp_respond send loop
- Fix type mismatch in parse_int by using INT_MAX instead of INT32_MAX
- Add portability fallback for accept4 on non-Linux systems
- Fix typo: "listaning" -> "listening" in error message
- Improve documentation for get_io_event return value handling
These fixes improve security, portability, and code robustness.1 parent 7b27ecd commit 57fff48
File tree
5 files changed
+84
-21
lines changed- src
5 files changed
+84
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
11 | 41 | | |
12 | 42 | | |
13 | 43 | | |
| |||
95 | 125 | | |
96 | 126 | | |
97 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
98 | 133 | | |
99 | 134 | | |
100 | 135 | | |
| |||
157 | 192 | | |
158 | 193 | | |
159 | 194 | | |
160 | | - | |
| 195 | + | |
| 196 | + | |
161 | 197 | | |
162 | 198 | | |
163 | 199 | | |
| |||
169 | 205 | | |
170 | 206 | | |
171 | 207 | | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
172 | 215 | | |
173 | 216 | | |
174 | 217 | | |
| |||
257 | 300 | | |
258 | 301 | | |
259 | 302 | | |
260 | | - | |
| 303 | + | |
261 | 304 | | |
262 | 305 | | |
263 | 306 | | |
| |||
344 | 387 | | |
345 | 388 | | |
346 | 389 | | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
347 | 393 | | |
348 | | - | |
349 | 394 | | |
350 | 395 | | |
351 | 396 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
248 | 248 | | |
249 | 249 | | |
250 | 250 | | |
251 | | - | |
| 251 | + | |
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
| |||
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
288 | | - | |
289 | | - | |
| 288 | + | |
290 | 289 | | |
291 | 290 | | |
292 | 291 | | |
| |||
326 | 325 | | |
327 | 326 | | |
328 | 327 | | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
329 | 332 | | |
330 | 333 | | |
331 | 334 | | |
332 | | - | |
333 | | - | |
334 | 335 | | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
335 | 340 | | |
336 | 341 | | |
337 | 342 | | |
| |||
590 | 595 | | |
591 | 596 | | |
592 | 597 | | |
| 598 | + | |
| 599 | + | |
593 | 600 | | |
594 | 601 | | |
595 | 602 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
| |||
88 | 90 | | |
89 | 91 | | |
90 | 92 | | |
91 | | - | |
92 | 93 | | |
93 | | - | |
| 94 | + | |
94 | 95 | | |
| 96 | + | |
95 | 97 | | |
96 | 98 | | |
97 | 99 | | |
| |||
182 | 184 | | |
183 | 185 | | |
184 | 186 | | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
185 | 191 | | |
186 | 192 | | |
187 | 193 | | |
| |||
205 | 211 | | |
206 | 212 | | |
207 | 213 | | |
208 | | - | |
209 | | - | |
| 214 | + | |
| 215 | + | |
210 | 216 | | |
211 | | - | |
| 217 | + | |
212 | 218 | | |
213 | 219 | | |
214 | 220 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
38 | 41 | | |
| 42 | + | |
| 43 | + | |
39 | 44 | | |
40 | 45 | | |
41 | 46 | | |
| |||
0 commit comments