[Bug 232642] sbin/ipfw show: segfault on parsing setdscp rules

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Wed Oct 24 16:45:01 UTC 2018


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

            Bug ID: 232642
           Summary: sbin/ipfw show: segfault on parsing setdscp rules
           Product: Base System
           Version: 11.0-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs at FreeBSD.org
          Reporter: sergey at akhmatov.ru
             Flags: maintainer-feedback?

Created attachment 198583
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=198583&action=edit
sbin/ipfw/ipfw2.c - fix ipfw show for rules with setdscp action

ipfw show fails to show rules with "setdscp" action for DSCP code values
without matching well-known class name.

Steps to reproduce:
# ipfw add 1000 setdscp 10 ip from any to any
01000 setdscp af11 ip from any to any
# ipfw add 1001 setdscp 11 ip from any to any
segmentation fault

# ipfw show 1000
01000   0     0 setdscp af11 ip from any to any
# ipfw show 1001
segmentation fault

The bug was introduced in r331668. 11.2-RELEASE and 12.0-BETA1 are affected.

Problem code in sbin/ipfw/ipfw2.c as follows:
---
        case O_SETDSCP:
                if (cmd->arg1 == IP_FW_TARG) {
                        bprintf(bp, "setdscp tablearg");
                        break;
                }
                s = match_value(f_ipdscp, cmd->arg1 & 0x3F);
                if (s != NULL)
                        bprintf(bp, "setdscp %s", s);
                else
                        bprintf(bp, "setdscp %s", cmd->arg1 & 0x3F);
---
cmd->arg1 is int, but is passed to "%s" format specifier. Changing it to "%d"
fixes things for me.

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


More information about the freebsd-bugs mailing list