| Summary: | sbin/ipfw show: segfault on parsing setdscp rules | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | Sergey Akhmatov <sergey> | ||||
| Component: | bin | Assignee: | Andrey V. Elsukov <ae> | ||||
| Status: | Closed FIXED | ||||||
| Severity: | Affects Only Me | CC: | bugs.freebsd.org | ||||
| Priority: | --- | Keywords: | patch | ||||
| Version: | CURRENT | ||||||
| Hardware: | Any | ||||||
| OS: | Any | ||||||
| Attachments: |
|
||||||
A commit references this bug: Author: ae Date: Thu Oct 25 18:06:23 UTC 2018 New revision: 339740 URL: https://svnweb.freebsd.org/changeset/base/339740 Log: Use correct format specificator to print setdscp action. PR: 232642 MFC after: 3 days Changes: head/sbin/ipfw/ipfw2.c Over to committer for possible MFC. A commit references this bug: Author: ae Date: Sun Oct 28 18:21:14 UTC 2018 New revision: 339841 URL: https://svnweb.freebsd.org/changeset/base/339841 Log: MFC r339740: Use correct format specificator to print setdscp action. PR: 232642 Approved by: re (rgrimes) Changes: _U stable/12/ stable/12/sbin/ipfw/ipfw2.c A commit references this bug: Author: ae Date: Sun Oct 28 18:23:14 UTC 2018 New revision: 339842 URL: https://svnweb.freebsd.org/changeset/base/339842 Log: MFC r339740: Use correct format specificator to print setdscp action. PR: 232642 Changes: _U stable/11/ stable/11/sbin/ipfw/ipfw2.c Fixed in head, stable/12 and stable/11. Thanks! *** Bug 232917 has been marked as a duplicate of this bug. *** |
Created attachment 198583 [details] 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.