mirror of
https://github.com/curl/curl.git
synced 2025-02-17 14:59:45 +08: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);
|
||||
Curl_rand_hex(easy, (unsigned char *) mime->boundary + 24,
|
||||
MIME_RAND_BOUNDARY_CHARS + 1);
|
||||
if(Curl_rand_hex(easy, (unsigned char *) mime->boundary + 24,
|
||||
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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user