diff options
author | loos <loos@FreeBSD.org> | 2014-07-05 20:16:02 +0000 |
---|---|---|
committer | loos <loos@FreeBSD.org> | 2014-07-05 20:16:02 +0000 |
commit | f995552a764a2c98cd7a2221aee581a0e5198186 (patch) | |
tree | 40fec5df2470ffcc4455887684b61029fd87f454 /sbin | |
parent | c5e392f88d5591c4d92dbc05e224ec98ddb1d609 (diff) | |
download | FreeBSD-src-f995552a764a2c98cd7a2221aee581a0e5198186.zip FreeBSD-src-f995552a764a2c98cd7a2221aee581a0e5198186.tar.gz |
Check the number of returned entries before doing any access to ifm_ulist.
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/etherswitchcfg/etherswitchcfg.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sbin/etherswitchcfg/etherswitchcfg.c b/sbin/etherswitchcfg/etherswitchcfg.c index dd68e67..f7f117a 100644 --- a/sbin/etherswitchcfg/etherswitchcfg.c +++ b/sbin/etherswitchcfg/etherswitchcfg.c @@ -235,6 +235,8 @@ set_port_media(struct cfg *cfg, char *argv[]) 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; |