commit 7e85cd5
default
·
2024-09-14 12:43:22 +0000 UTC
parent b6f84c3
Fixed crash in xs_multipart_form_data().
1 files changed,
+5,
-0
M
xs_url.h
M
xs_url.h
+5,
-0
1@@ -143,6 +143,11 @@ xs_dict *xs_multipart_form_data(const char *payload, int p_size, const char *hea
2 if (p[0] == 13 && p[1] == 10)
3 break;
4 q = strchr(p, '\r');
5+
6+ /* unexpected formatting, fail immediately */
7+ if (q == NULL)
8+ return p_vars;
9+
10 s1 = xs_realloc(NULL, q - p + 1);
11 memcpy(s1, p, q - p);
12 s1[q - p] = '\0';