Merge commit from fork

* [libesl] Validate `Content-Length` in `esl_recv_event`.

`atol()` accepted negative values, allowing a remote ESL peer to cause
a one-byte heap underwrite (`Content-Length: -1`) or NULL-pointer
dereference (`Content-Length: -2`, since `esl_assert` compiles out
under `NDEBUG`). Reject negative and oversized values, and check
`malloc` failure instead of relying on `assert`.

Cap at `ESL_MAX_CONTENT_LENGTH` (16 MiB).

* [libesl] Add test_recv_event.
This commit is contained in:
Dmitry Verenitsin authored and GitHub committed 2026-05-26 22:28:23 +03:00
1 parent 02ac36bb11
commit 22de26cc7c
7 files changed
+134 -6

No files matched your search

+2
View File
@@ -217,6 +217,8 @@ typedef enum {
#define esl_strlen_zero_buf(s) (*(s) == '\0')
#define end_of(_s) *(*_s == '\0' ? _s : _s + strlen(_s) - 1)
#define ESL_MAX_CONTENT_LENGTH (16 * 1024 * 1024)
#ifdef WIN32
#include <winsock2.h>
#include <windows.h>