diff options
author | Daniel Stenberg <daniel@haxx.se> | 2018-07-26 16:55:59 +0300 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2018-07-28 22:36:15 +0200 |
commit | d3905419444614463506243930be1648fb2d7aa7 (patch) | |
tree | 2f118698975aa696341d040bd1584604ca5d3350 /lib/mime.c | |
parent | 7f5e5706166442186ce0ccbf89f34603781ac94a (diff) | |
download | curl-d3905419444614463506243930be1648fb2d7aa7.tar.gz |
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
Diffstat (limited to 'lib/mime.c')
-rw-r--r-- | lib/mime.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/mime.c b/lib/mime.c index fd7beb9a4..ca492d11a 100644 --- a/lib/mime.c +++ b/lib/mime.c @@ -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); } |