From: Volker Lendecke Date: Tue, 10 Sep 2024 06:52:16 +0000 (+0200) Subject: libsmb: Use nybble_to_hex_upper() in virusfilter_url_quote() X-Git-Tag: tdb-1.4.13~1191 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=eaaba242a208389853d48cbe4880e8944315f9b9;p=thirdparty%2Fsamba.git libsmb: Use nybble_to_hex_upper() in virusfilter_url_quote() Signed-off-by: Volker Lendecke Reviewed-by: Noel Power --- diff --git a/source3/modules/vfs_virusfilter_sophos.c b/source3/modules/vfs_virusfilter_sophos.c index c8cdec5fd7f..c2cfa7ce6cc 100644 --- a/source3/modules/vfs_virusfilter_sophos.c +++ b/source3/modules/vfs_virusfilter_sophos.c @@ -33,7 +33,6 @@ static void virusfilter_sophos_scan_end(struct virusfilter_config *config); static int virusfilter_url_quote(const char *src, char *dst, int dst_size) { char *dst_c = dst; - static char hex[] = "0123456789ABCDEF"; for (; *src != '\0'; src++) { if ((*src < '0' && *src != '-' && *src != '.' && *src != '/') || @@ -45,8 +44,8 @@ static int virusfilter_url_quote(const char *src, char *dst, int dst_size) return -1; } *dst_c++ = '%'; - *dst_c++ = hex[(*src >> 4) & 0x0F]; - *dst_c++ = hex[*src & 0x0F]; + *dst_c++ = nybble_to_hex_upper(*src >> 4); + *dst_c++ = nybble_to_hex_upper(*src); dst_size -= 3; } else { if (dst_size < 2) {