p2putil: Ensure non-negative index in p2p_get_random_string
This commit is contained in:
parent
d96f542951
commit
69d9a07e34
|
@ -2637,7 +2637,7 @@ void p2p_get_random_string(char *buf, size_t len)
|
||||||
l_getrandom(buf, len);
|
l_getrandom(buf, len);
|
||||||
|
|
||||||
while (len) {
|
while (len) {
|
||||||
int index = *buf % set_size;
|
int index = (uint8_t) *buf % set_size;
|
||||||
|
|
||||||
*buf++ = CHARSET[index];
|
*buf++ = CHARSET[index];
|
||||||
len--;
|
len--;
|
||||||
|
|
Loading…
Reference in New Issue