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; _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"