Date: Sat, 5 Jul 2014 20:16:02 +0000 (UTC) From: Luiz Otavio O Souza <loos@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r268301 - head/sbin/etherswitchcfg Message-ID: <201407052016.s65KG2gi048927@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: loos Date: Sat Jul 5 20:16:02 2014 New Revision: 268301 URL: http://svnweb.freebsd.org/changeset/base/268301 Log: Check the number of returned entries before doing any access to ifm_ulist. Modified: head/sbin/etherswitchcfg/etherswitchcfg.c Modified: head/sbin/etherswitchcfg/etherswitchcfg.c ============================================================================== --- head/sbin/etherswitchcfg/etherswitchcfg.c Sat Jul 5 20:08:35 2014 (r268300) +++ head/sbin/etherswitchcfg/etherswitchcfg.c Sat Jul 5 20:16:02 2014 (r268301) @@ -235,6 +235,8 @@ set_port_media(struct cfg *cfg, char *ar p.es_ifmr.ifm_count = IFMEDIAREQ_NULISTENTRIES; if (ioctl(cfg->fd, IOETHERSWITCHGETPORT, &p) != 0) err(EX_OSERR, "ioctl(IOETHERSWITCHGETPORT)"); + if (p.es_ifmr.ifm_count == 0) + return; subtype = get_media_subtype(IFM_TYPE(ifm_ulist[0]), argv[1]); p.es_ifr.ifr_media = (p.es_ifmr.ifm_current & IFM_IMASK) | IFM_TYPE(ifm_ulist[0]) | subtype;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201407052016.s65KG2gi048927>