Boolean AND was applied instead of binary one, causing the exclamation
mark to be printed whenever info->bitmask was non-zero. In practice,
this leads to incorrect output if e.g. --among-src was given with an
inverted match as well as --among-dst with a non-inverted one. Output
would then list both matches as inverted.

Signed-off-by: Phil Sutter <[email protected]>
---
 extensions/ebt_among.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/extensions/ebt_among.c b/extensions/ebt_among.c
index b1560e8f09e8d..30c098cf69f96 100644
--- a/extensions/ebt_among.c
+++ b/extensions/ebt_among.c
@@ -436,14 +436,14 @@ static void print(const struct ebt_u_entry *entry,
 
        if (info->wh_dst_ofs) {
                printf("--among-dst ");
-               if (info->bitmask && EBT_AMONG_DST_NEG) {
+               if (info->bitmask & EBT_AMONG_DST_NEG) {
                        printf("! ");
                }
                wormhash_printout(ebt_among_wh_dst(info));
        }
        if (info->wh_src_ofs) {
                printf("--among-src ");
-               if (info->bitmask && EBT_AMONG_SRC_NEG) {
+               if (info->bitmask & EBT_AMONG_SRC_NEG) {
                        printf("! ");
                }
                wormhash_printout(ebt_among_wh_src(info));
-- 
2.19.0

Reply via email to