1
0
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:
Daniel Stenberg 2018-07-26 16:55:59 +03:00
parent 7f5e570616
commit d390541944
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -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);
} }