mirror of
https://github.com/moparisthebest/curl
synced 2024-11-12 04:25:08 -05:00
mime: check Curl_rand_hex's return code
Bug: https://curl.haxx.se/mail/archive-2018-07/0015.html Reported-by: Jeffrey Walton Closes #2795
This commit is contained in:
parent
7f5e570616
commit
d390541944
@ -1228,8 +1228,13 @@ curl_mime *curl_mime_init(struct Curl_easy *easy)
|
|||||||
}
|
}
|
||||||
|
|
||||||
memset(mime->boundary, '-', 24);
|
memset(mime->boundary, '-', 24);
|
||||||
Curl_rand_hex(easy, (unsigned char *) mime->boundary + 24,
|
if(Curl_rand_hex(easy, (unsigned char *) mime->boundary + 24,
|
||||||
MIME_RAND_BOUNDARY_CHARS + 1);
|
MIME_RAND_BOUNDARY_CHARS + 1)) {
|
||||||
|
/* failed to get random separator, bail out */
|
||||||
|
free(mime->boundary);
|
||||||
|
free(mime);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
mimesetstate(&mime->state, MIMESTATE_BEGIN, NULL);
|
mimesetstate(&mime->state, MIMESTATE_BEGIN, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user