git: ifconfig(8): Fix bug in interface address configuration

Aaron LI aly at crater.dragonflybsd.org
Fri Feb 9 01:43:06 PST 2024


commit 1078bf3cf6d3c6c2858102d0fc6c8ce9ed494cff
Author: Aaron LI <aly at aaronly.me>
Date:   Fri Feb 9 17:02:50 2024 +0800

    ifconfig(8): Fix bug in interface address configuration
    
    When the interface name had a length of >= 8, the address configuration
    would fail with the ENXIO error, i.e., "no such interface".
    
    This bug was made by me in commit c29ec76.  It was caused by the
    interface was truncated because the destination buffer size was wrongly
    determined, as I was using sizeof() on a 'void *' pointer instead of the
    actual interface name buffer.
    
    Fix it by directly using IFNAMSIZ instead of sizeof().

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

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/1078bf3cf6d3c6c2858102d0fc6c8ce9ed494cff


-- 
DragonFly BSD source repository


More information about the Commits mailing list