diff options
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 | |||
| 289 | po = p - payload; | 289 | po = p - payload; |
| 290 | ps = q - p - 2; /* - 2 because the final \r\n */ | 290 | ps = q - p - 2; /* - 2 because the final \r\n */ |
| 291 | 291 | ||
| 292 | if (ps <= 0) | ||
| 293 | break; | ||
| 294 | |||
| 295 | /* is it a filename? */ | 292 | /* is it a filename? */ |
| 296 | if (fn != NULL) { | 293 | if (fn != NULL) { |
| 297 | /* p_var value is a list */ | 294 | /* 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 | |||
| 315 | } | 312 | } |
| 316 | else { | 313 | else { |
| 317 | /* regular variable; just copy */ | 314 | /* regular variable; just copy */ |
| 318 | xs *vc = xs_realloc(NULL, ps + 1); | 315 | if (ps > 0) { |
| 319 | memcpy(vc, payload + po, ps); | 316 | xs *vc = xs_realloc(NULL, ps + 1); |
| 320 | vc[ps] = '\0'; | 317 | memcpy(vc, payload + po, ps); |
| 318 | vc[ps] = '\0'; | ||
| 321 | 319 | ||
| 322 | if (xs_is_string(vn) && xs_is_string(vc)) | 320 | if (xs_is_string(vn) && xs_is_string(vc)) |
| 323 | p_vars = xs_dict_append(p_vars, vn, vc); | 321 | p_vars = xs_dict_append(p_vars, vn, vc); |
| 322 | } | ||
| 324 | } | 323 | } |
| 325 | 324 | ||
| 326 | /* move on */ | 325 | /* move on */ |