]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
extensions: cluster: Avoid undefined shift
authorPhil Sutter <phil@nwl.cc>
Thu, 5 Dec 2019 12:36:31 +0000 (13:36 +0100)
committerPhil Sutter <phil@nwl.cc>
Fri, 6 Dec 2019 11:12:08 +0000 (12:12 +0100)
Value 1 is signed by default and left-shifting by 31 is undefined for
those. Fix this by marking the value as unsigned.

Fixes: 64a0e09894e52 ("extensions: libxt_cluster: Add translation to nft")
extensions/libxt_cluster.c

index c9c35ee22e3df82b07e22c7942749b7346d52840..d164bf696016675e5253370c515a382916e5b2b6 100644 (file)
@@ -156,7 +156,7 @@ static int cluster_xlate(struct xt_xlate *xl,
                xt_xlate_add(xl, "%s %u seed 0x%08x ", jhash_st,
                                info->total_nodes, info->hash_seed);
                for (node = 0; node < 32; node++) {
-                       if (info->node_mask & (1 << node)) {
+                       if (info->node_mask & (1u << node)) {
                                if (needs_set == 0) {
                                        xt_xlate_add(xl, "{ ");
                                        needs_set = 1;