diff options
| author | grunfink <grunfink@comam.es> | 2026-02-23 13:52:35 +0100 |
|---|---|---|
| committer | grunfink <grunfink@comam.es> | 2026-02-23 13:52:35 +0100 |
| commit | 5925e1f93e5a0d77c45e02c641d688d37be45bdf (patch) | |
| tree | 8ba05b414fb7043217877615df66f97c5b1f59b7 /xs_url.h | |
| parent | a8d907cac5af7d85d9231d70ec2486c56da80bd0 (diff) | |
Fixed latest breakage in xs_multipart_form_data().
Diffstat (limited to 'xs_url.h')
| -rw-r--r-- | xs_url.h | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -289,9 +289,6 @@ xs_dict *xs_multipart_form_data(const char *payload, int p_size, const char *hea po = p - payload; ps = q - p - 2; /* - 2 because the final \r\n */ - if (ps <= 0) - break; - /* is it a filename? */ if (fn != NULL) { /* p_var value is a list */ @@ -315,12 +312,14 @@ xs_dict *xs_multipart_form_data(const char *payload, int p_size, const char *hea } else { /* regular variable; just copy */ - xs *vc = xs_realloc(NULL, ps + 1); - memcpy(vc, payload + po, ps); - vc[ps] = '\0'; + if (ps > 0) { + xs *vc = xs_realloc(NULL, ps + 1); + memcpy(vc, payload + po, ps); + vc[ps] = '\0'; - if (xs_is_string(vn) && xs_is_string(vc)) - p_vars = xs_dict_append(p_vars, vn, vc); + if (xs_is_string(vn) && xs_is_string(vc)) + p_vars = xs_dict_append(p_vars, vn, vc); + } } /* move on */ |