Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Jan 2023 19:29:17 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 269075] pfctl and ifconfig invalid if statements
Message-ID:  <bug-269075-227@https.bugs.freebsd.org/bugzilla/>

index | next in thread | raw e-mail

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=269075

            Bug ID: 269075
           Summary: pfctl and ifconfig invalid if statements
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: nreilly@blackberry.com

sbin/ifconfig/ifieee80211.c in printmimo()
        for (i = 0; i < IEEE80211_MAX_CHAINS; i++) {
                if (mi->ch[i].rssi != 0) {
                        r = 1;

But rssi is an array so the if statement is always true. Suggested fix is:
        for (i = 0; i < IEEE80211_MAX_CHAINS; i++) {
                if (mi->ch[i].rssi[0] != 0) {
                        r = 1;


There are similar issues in sbin/pfctl/pfctl.c in pfctl_show_rules(). There are
two instances (lines 1312 and 1366) of:

                        if (rule.label[0] && (opts & PF_OPT_SHOWALL))
                                labels = 1;

But rule is a two dimensional array so the if statement is always true.
Suggested fix is:
                        if (rule.label[0][0] && (opts & PF_OPT_SHOWALL))
                                labels = 1;

-- 
You are receiving this mail because:
You are the assignee for the bug.

help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-269075-227>