]> git.ipfire.org Git - thirdparty/xtables-addons.git/commitdiff
compat_xtables: use more accurate printf format for NIPQUAD
authorJan Engelhardt <jengelh@inai.de>
Thu, 15 Jun 2017 10:18:41 +0000 (12:18 +0200)
committerJan Engelhardt <jengelh@inai.de>
Thu, 15 Jun 2017 10:18:41 +0000 (12:18 +0200)
We never expect to emit values greater than 255 here, so use %hhu to
address more sprintf warnings.

extensions/compat_xtables.h

index 78a7fbfa9a308cf137996879f80d983ca81b4596..d8882ac7670aa3d7b9a35c9077950e82e3e2937c 100644 (file)
@@ -35,7 +35,7 @@
                ntohs((addr).s6_addr16[5]), \
                ntohs((addr).s6_addr16[6]), \
                ntohs((addr).s6_addr16[7])
-#      define NIP6_FMT "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x"
+#      define NIP6_FMT "%04hx:%04hx:%04hx:%04hx:%04hx:%04hx:%04hx:%04hx"
 #endif
 #if !defined(NIPQUAD) && !defined(NIPQUAD_FMT)
 #      define NIPQUAD(addr) \
@@ -43,7 +43,7 @@
                ((const unsigned char *)&addr)[1], \
                ((const unsigned char *)&addr)[2], \
                ((const unsigned char *)&addr)[3]
-#      define NIPQUAD_FMT "%u.%u.%u.%u"
+#      define NIPQUAD_FMT "%hhu.%hhu.%hhu.%hhu"
 #endif
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0)