diff options
author | alfred <alfred@FreeBSD.org> | 2001-02-26 09:52:43 +0000 |
---|---|---|
committer | alfred <alfred@FreeBSD.org> | 2001-02-26 09:52:43 +0000 |
commit | 6ebe771166f9f49f31682fd7529d3c10a3d6956a (patch) | |
tree | 5dbc13d35aca1e2ad39db8cf963605de7c38cf4b /sys/net/if_media.c | |
parent | 2534aff6a5eaacba180d4be5b1637acb6e7cc404 (diff) | |
download | FreeBSD-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.c | 3 |
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), |