mirror of
https://github.com/curl/curl.git
synced 2026-08-25 13:53:37 +03: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
1 changed files with 7 additions and 2 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue