kern/177871: [etherswitchcfg] [patch] uninitialized variable while setting port vlangroup

Luiz Otavio O Souza at
Mon Apr 15 13:30:00 UTC 2013

>Number:         177871
>Category:       kern
>Synopsis:       [etherswitchcfg] [patch] uninitialized variable while setting port vlangroup
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Apr 15 13:30:00 UTC 2013
>Originator:     Luiz Otavio O Souza
>Release:        -HEAD r248943
FreeBSD rb433 10.0-CURRENT FreeBSD 10.0-CURRENT #88 r248943M: Sat Apr 13 10:04:43 BRT 2013     root at devel:/data/rb/rb433/obj/mips.mips/data/rb/rb433/src/sys/RB433U  mips
etherswitchcfg(8) fails to set the vlangroup (similar to PVID) for a port because of an uninitialized variable.
root at rb433:~ # etherswitchcfg vlangroup2 vlan 10 members 1,2
        vlan: 10
        members 1,2
root at rb433:~ # etherswitchcfg port2 vlangroup 2
etherswitchcfg: ioctl(IOETHERSWITCHGETPORT): Bad address

Apply the attached patch.

Patch attached with submission follows:

Index: sbin/etherswitchcfg/etherswitchcfg.c
--- sbin/etherswitchcfg/etherswitchcfg.c	(revision 248943)
+++ sbin/etherswitchcfg/etherswitchcfg.c	(working copy)
@@ -139,6 +139,7 @@
 	v = strtol(argv[1], NULL, 0);
 	if (v < 0 || v >= cfg->info.es_nvlangroups)
 		errx(EX_USAGE, "vlangroup must be between 0 and %d", cfg->info.es_nvlangroups-1);
+	bzero(&p, sizeof(p));
 	p.es_port = cfg->unit;
 	if (ioctl(cfg->fd, IOETHERSWITCHGETPORT, &p) != 0)


More information about the freebsd-bugs mailing list