Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Apr 2013 13:21:19 GMT
From:      Luiz Otavio O Souza <loos.br@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/177871: [etherswitchcfg] [patch] uninitialized variable while setting port vlangroup
Message-ID:  <201304151321.r3FDLJTG083699@red.freebsd.org>
Resent-Message-ID: <201304151330.r3FDU0ks045507@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Apr 15 13:30:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Luiz Otavio O Souza
>Release:        -HEAD r248943
>Organization:
>Environment:
FreeBSD rb433 10.0-CURRENT FreeBSD 10.0-CURRENT #88 r248943M: Sat Apr 13 10:04:43 BRT 2013     root@devel:/data/rb/rb433/obj/mips.mips/data/rb/rb433/src/sys/RB433U  mips
>Description:
etherswitchcfg(8) fails to set the vlangroup (similar to PVID) for a port because of an uninitialized variable.
>How-To-Repeat:
root@rb433:~ # etherswitchcfg vlangroup2 vlan 10 members 1,2
vlangroup2:
        vlan: 10
        members 1,2
root@rb433:~ # etherswitchcfg port2 vlangroup 2
etherswitchcfg: ioctl(IOETHERSWITCHGETPORT): Bad address

>Fix:
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)
 		err(EX_OSERR, "ioctl(IOETHERSWITCHGETPORT)");


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201304151321.r3FDLJTG083699>