git: ifconfig(8): Fix regdomain.xml parsing issue

Aaron LI aly at crater.dragonflybsd.org
Thu Dec 31 07:50:13 PST 2020


commit f8def4a327ec9f17a28a614aeeb6984025cc471d
Author: Aaron LI <aly at aaronly.me>
Date:   Thu Dec 31 23:13:50 2020 +0800

    ifconfig(8): Fix regdomain.xml parsing issue
    
    The original regdomain.[ch] code can't handle unknown netbands in
    regdomain.xml, mainly because it didn't distinguish the following two
    cases:
    
    * <netband><band><freqband ref="xxx">...
    * <freqband id="xxx">...
    
    Therefore, it tried to strdup(id) but with 'id = NULL' and thus caused
    segfault errors with the new regdomain.xml, like:
    
    ```
    ifconfig: unknown mode "11ac" at line 114
    ifconfig: band without enclosing netband at line 115
    [1]    326065 segmentation fault (core dumped)  ifconfig
    ```
    
    This commit fixes the above segfault error by ignoring unknown netbands.
    Although ifconfig(8) emits some warnings about unknown/unexpected
    elements, it works as expected :D
    
    Reported-by: Gonzalo Nemmi (noob237 on IRC)

Summary of changes:
 sbin/ifconfig/regdomain.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/f8def4a327ec9f17a28a614aeeb6984025cc471d


-- 
DragonFly BSD source repository


More information about the Commits mailing list