Skip to content

Commit

Permalink
mime: check Curl_rand_hex's return code
Browse files Browse the repository at this point in the history
Bug: https://curl.haxx.se/mail/archive-2018-07/0015.html
Reported-by: Jeffrey Walton
Closes curl#2795
  • Loading branch information
bagder authored and xquery committed Aug 9, 2018
1 parent 8db967e commit 9c9cf06
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/mime.c
Expand Up @@ -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);
}

Expand Down

0 comments on commit 9c9cf06

Please sign in to comment.