aboutsummaryrefslogtreecommitdiff
path: root/xs_url.h
diff options
context:
space:
mode:
authordefault <nobody@localhost>2024-09-14 14:43:22 +0200
committerdefault <nobody@localhost>2024-09-14 14:43:22 +0200
commit7e85cd570d78fad7375917b3fcc4ee5cfacfeaab (patch)
tree403fd7ae56b718db04ce7f1590390d35737f9056 /xs_url.h
parentb6f84c3a958e86c048f227cc6d0fe128db5ba366 (diff)
Fixed crash in xs_multipart_form_data().
Diffstat (limited to 'xs_url.h')
-rw-r--r--xs_url.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/xs_url.h b/xs_url.h
index efc883b..d6dd47a 100644
--- a/xs_url.h
+++ b/xs_url.h
@@ -143,6 +143,11 @@ xs_dict *xs_multipart_form_data(const char *payload, int p_size, const char *hea
if (p[0] == 13 && p[1] == 10)
break;
q = strchr(p, '\r');
+
+ /* unexpected formatting, fail immediately */
+ if (q == NULL)
+ return p_vars;
+
s1 = xs_realloc(NULL, q - p + 1);
memcpy(s1, p, q - p);
s1[q - p] = '\0';