mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-22 05:15:04 +00:00
Fixed crash in xs_multipart_form_data().
This commit is contained in:
parent
b6f84c3a95
commit
7e85cd570d
1 changed files with 5 additions and 0 deletions
5
xs_url.h
5
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)
|
if (p[0] == 13 && p[1] == 10)
|
||||||
break;
|
break;
|
||||||
q = strchr(p, '\r');
|
q = strchr(p, '\r');
|
||||||
|
|
||||||
|
/* unexpected formatting, fail immediately */
|
||||||
|
if (q == NULL)
|
||||||
|
return p_vars;
|
||||||
|
|
||||||
s1 = xs_realloc(NULL, q - p + 1);
|
s1 = xs_realloc(NULL, q - p + 1);
|
||||||
memcpy(s1, p, q - p);
|
memcpy(s1, p, q - p);
|
||||||
s1[q - p] = '\0';
|
s1[q - p] = '\0';
|
||||||
|
|
Loading…
Reference in a new issue