]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libsmb: Use nybble_to_hex_upper() in virusfilter_url_quote()
authorVolker Lendecke <vl@samba.org>
Tue, 10 Sep 2024 06:52:16 +0000 (08:52 +0200)
committerVolker Lendecke <vl@samba.org>
Fri, 20 Sep 2024 17:13:37 +0000 (17:13 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
source3/modules/vfs_virusfilter_sophos.c

index c8cdec5fd7fc278550b878548f085bdf869ee14d..c2cfa7ce6cc38561cc3b73718c1637fcd4f1f4e9 100644 (file)
@@ -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) {