summaryrefslogtreecommitdiffstats
path: root/sys/net/if_media.c
diff options
context:
space:
mode:
authoralfred <alfred@FreeBSD.org>2001-02-26 09:52:43 +0000
committeralfred <alfred@FreeBSD.org>2001-02-26 09:52:43 +0000
commit6ebe771166f9f49f31682fd7529d3c10a3d6956a (patch)
tree5dbc13d35aca1e2ad39db8cf963605de7c38cf4b /sys/net/if_media.c
parent2534aff6a5eaacba180d4be5b1637acb6e7cc404 (diff)
downloadFreeBSD-src-6ebe771166f9f49f31682fd7529d3c10a3d6956a.zip
FreeBSD-src-6ebe771166f9f49f31682fd7529d3c10a3d6956a.tar.gz
Protect against negative numbers as well
Diffstat (limited to 'sys/net/if_media.c')
-rw-r--r--sys/net/if_media.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/net/if_media.c b/sys/net/if_media.c
index 6b67f1e..691c8cd 100644
--- a/sys/net/if_media.c
+++ b/sys/net/if_media.c
@@ -294,9 +294,12 @@ ifmedia_ioctl(ifp, ifr, ifm, cmd)
/*
* Don't allow the user to ask for too many
+ * or a negative number.
*/
if (ifmr->ifm_count > usermax)
ifmr->ifm_count = usermax;
+ else if (ifmr->ifm_count < 0)
+ return (EINVAL);
if (ifmr->ifm_count != 0) {
kptr = (int *)malloc(ifmr->ifm_count * sizeof(int),
OpenPOWER on IntegriCloud