]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
libxt_string: replace hex codes by char equivalents
authorJan Engelhardt <jengelh@medozas.de>
Thu, 25 Aug 2011 10:11:20 +0000 (12:11 +0200)
committerJan Engelhardt <jengelh@medozas.de>
Thu, 25 Aug 2011 10:11:20 +0000 (12:11 +0200)
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
extensions/libxt_string.c

index 365019f736fec0085dd5d59fcf37a81dee09fc76..472035fbb46e293a6cec4bb838c29f14409583e1 100644 (file)
@@ -218,7 +218,7 @@ is_hex_string(const char *str, const unsigned short int len)
                if (! isprint(str[i]))
                        return 1;  /* string contains at least one non-printable char */
        /* use hex output if the last char is a "\" */
-       if ((unsigned char) str[len-1] == 0x5c)
+       if (str[len-1] == '\\')
                return 1;
        return 0;
 }
@@ -242,8 +242,8 @@ print_string(const char *str, const unsigned short int len)
        unsigned int i;
        printf(" \"");
        for (i=0; i < len; i++) {
-               if ((unsigned char) str[i] == 0x22)  /* escape any embedded quotes */
-                       printf("%c", 0x5c);
+               if (str[i] == '\"')  /* escape any embedded quotes */
+                       putchar('\\');
                printf("%c", (unsigned char) str[i]);
        }
        printf("\"");  /* closing quote */