diff options
| author | default <nobody@localhost> | 2025-02-06 20:10:52 +0100 |
|---|---|---|
| committer | default <nobody@localhost> | 2025-02-06 20:10:52 +0100 |
| commit | 3099d179be9ffb38753e412480e23e5391913751 (patch) | |
| tree | c1018e0565b8d186991e52c9c9975d1ae5a42971 | |
| parent | f4fee170ce4d02182081f084975c3cd7d9ba4e93 (diff) | |
Fixed a crash in xs_multipart_form_data().
| -rw-r--r-- | xs_url.h | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -274,7 +274,8 @@ xs_dict *xs_multipart_form_data(const char *payload, int p_size, const char *hea l1 = xs_list_append(l1, vpo); l1 = xs_list_append(l1, vps); - p_vars = xs_dict_append(p_vars, vn, l1); + if (xs_is_string(vn)) + p_vars = xs_dict_append(p_vars, vn, l1); } else { /* regular variable; just copy */ @@ -282,7 +283,8 @@ xs_dict *xs_multipart_form_data(const char *payload, int p_size, const char *hea memcpy(vc, payload + po, ps); vc[ps] = '\0'; - 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 */ |