Commit bad068c
committed
CVPN-2035: Fix using correct struct for validating length
Existing code had used `he_msg_auth_hdr_t` instead of `he_msg_auth_buf_t`
or `he_msg_auth_token_t` struct.
The difference between the structs `he_msg_auth_buf_t` and `he_msg_auth_hdr_t` is 2.
This causes memory bounding logic to fail, allowing malicious requests
with additional 2 bytes in length to continue. (ex: actual buf: 2 bytes, buf_length: 4)
But since we use local stack buffer which is reseted on every packet, the bytes
sent to the callback could only be having 0 values.
https://github.com/expressvpn/lightway-core/blob/d51702d8f8bd37874e5e70da434bf22930a6b48a/src/he/flow.c#L464
Fix this by using the correct struct in bound checking.
Tests which were added in previous commit will pass now.1 parent d09897c commit bad068c
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
279 | 279 | | |
280 | 280 | | |
281 | 281 | | |
282 | | - | |
| 282 | + | |
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
| |||
298 | 298 | | |
299 | 299 | | |
300 | 300 | | |
301 | | - | |
| 301 | + | |
302 | 302 | | |
303 | 303 | | |
304 | 304 | | |
| |||
0 commit comments