Skip to content

Commit 7a11ba8

Browse files
committed
Addressed Copilot's comments
1 parent e335905 commit 7a11ba8

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ EXE=build/tcpecho build/tcp_netcat_poll build/tcp_netcat_select \
183183
build/test-evloop build/test-dns build/test-wolfssl-forwarding \
184184
build/test-ttl-expired build/test-wolfssl build/test-httpd \
185185
build/test-http-smuggle build/test-http-arg-oob \
186+
build/test-posix-errno \
186187
build/ipfilter-logger \
187188
build/test-esp build/esp-server
188189
ifeq ($(UNAME_S),Linux)

src/test/test_http_smuggle.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,20 @@ static int upload_handler(struct httpd *httpd, struct http_client *hc, struct ht
7070
static int run(struct httpd *httpd, const char *raw, size_t len)
7171
{
7272
struct http_client hc;
73+
/* Copy into a writable scratch buffer that mirrors the production recv
74+
* buffer, so the test never hands a read-only string literal to the
75+
* parser - safe even if parse_http_request ever normalizes in-place. */
76+
uint8_t buf[HTTP_RECV_BUF_LEN];
77+
if (len > sizeof(buf))
78+
len = sizeof(buf);
79+
memcpy(buf, raw, len);
7380
memset(&hc, 0, sizeof(hc));
7481
hc.httpd = httpd;
7582
hc.client_sd = 1;
7683
hc.ssl = NULL;
7784
handler_calls = 0;
7885
handler_body_len = 0;
79-
return parse_http_request(&hc, (uint8_t *)raw, len);
86+
return parse_http_request(&hc, buf, len);
8087
}
8188

8289
#define CHECK(cond) do { if (!(cond)) { \

0 commit comments

Comments
 (0)