diff options
author | Daniel Stenberg <daniel@haxx.se> | 2016-11-11 14:53:36 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2016-11-14 08:23:52 +0100 |
commit | f682156a4fc6c43fb38db4abda49b9a1bc1ed368 (patch) | |
tree | 32b49aeaefc66c54426f8e7e5e9c2d9aced6147d /lib/formdata.c | |
parent | 050aa803096f6d745a173d5810c65dd829f2f8b2 (diff) | |
download | curl-f682156a4fc6c43fb38db4abda49b9a1bc1ed368.tar.gz |
Curl_rand: fixed and moved to rand.c
Now Curl_rand() is made to fail if it cannot get the necessary random
level.
Changed the proto of Curl_rand() slightly to provide a number of ints at
once.
Moved out from vtls, since it isn't a TLS function and vtls provides
Curl_ssl_random() for this to use.
Discussion: https://curl.haxx.se/mail/lib-2016-11/0119.html
Diffstat (limited to 'lib/formdata.c')
-rw-r--r-- | lib/formdata.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/formdata.c b/lib/formdata.c index 785f1a678..1001bc191 100644 --- a/lib/formdata.c +++ b/lib/formdata.c @@ -36,6 +36,7 @@ #include "strcase.h" #include "sendf.h" #include "strdup.h" +#include "rand.h" /* The last 3 #include files should be in this order */ #include "curl_printf.h" #include "curl_memory.h" @@ -1569,8 +1570,12 @@ static char *formboundary(struct Curl_easy *data) { /* 24 dashes and 16 hexadecimal digits makes 64 bit (18446744073709551615) combinations */ - return aprintf("------------------------%08x%08x", - Curl_rand(data), Curl_rand(data)); + unsigned int rnd[2]; + CURLcode result = Curl_rand(data, &rnd[0], 2); + if(result) + return NULL; + + return aprintf("------------------------%08x%08x", rnd[0], rnd[1]); } #else /* CURL_DISABLE_HTTP */ |