From a615d0ed74c0917429560bf70cb52ccc9ae2f6f3 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sun, 29 Mar 2026 09:21:42 +0200 Subject: [PATCH] base64: reject signed chars --- src/libsodium/sodium/codecs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libsodium/sodium/codecs.c b/src/libsodium/sodium/codecs.c index e2ea5486..720a1fd9 100644 --- a/src/libsodium/sodium/codecs.c +++ b/src/libsodium/sodium/codecs.c @@ -125,8 +125,9 @@ b64_byte_to_char(unsigned int x) } static unsigned int -b64_char_to_byte(int c) +b64_char_to_byte(int c_) { + const unsigned int c = (unsigned char) c_; const unsigned int x = (GE(c, 'A') & LE(c, 'Z') & (c - 'A')) | (GE(c, 'a') & LE(c, 'z') & (c - ('a' - 26))) | @@ -146,8 +147,9 @@ b64_byte_to_urlsafe_char(unsigned int x) } static unsigned int -b64_urlsafe_char_to_byte(int c) +b64_urlsafe_char_to_byte(int c_) { + const unsigned int c = (unsigned char) c_; const unsigned x = (GE(c, 'A') & LE(c, 'Z') & (c - 'A')) | (GE(c, 'a') & LE(c, 'z') & (c - ('a' - 26))) |