From 69d9a07e34cc6c41845cc0f7972c83f12168bfd9 Mon Sep 17 00:00:00 2001 From: Andrew Zaborowski Date: Fri, 4 Jun 2021 03:50:42 +0200 Subject: [PATCH] p2putil: Ensure non-negative index in p2p_get_random_string --- src/p2putil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p2putil.c b/src/p2putil.c index 6ea18b74..5313b34c 100644 --- a/src/p2putil.c +++ b/src/p2putil.c @@ -2637,7 +2637,7 @@ void p2p_get_random_string(char *buf, size_t len) l_getrandom(buf, len); while (len) { - int index = *buf % set_size; + int index = (uint8_t) *buf % set_size; *buf++ = CHARSET[index]; len--;