mirror of
https://github.com/curl/curl.git
synced 2025-02-17 14:59:45 +08:00
rand: fix 'alnum': array is too small to include a terminating null character
It was that small on purpose, but this change now adds the null byte to
avoid the error.
Follow-up to 3aa3cc9b05
Reported-by: Dan Fandrich
Ref: #11838
Closes #11870
This commit is contained in:
parent
adbb7a030d
commit
706eff9f1f
@ -275,14 +275,14 @@ CURLcode Curl_rand_hex(struct Curl_easy *data, unsigned char *rnd,
|
||||
* alphanumerical chars PLUS a null-terminating byte.
|
||||
*/
|
||||
|
||||
static const char alnum[26 + 26 + 10] =
|
||||
static const char alnum[] =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
|
||||
CURLcode Curl_rand_alnum(struct Curl_easy *data, unsigned char *rnd,
|
||||
size_t num)
|
||||
{
|
||||
CURLcode result = CURLE_OK;
|
||||
const int alnumspace = sizeof(alnum);
|
||||
const int alnumspace = sizeof(alnum) - 1;
|
||||
unsigned int r;
|
||||
DEBUGASSERT(num > 1);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user