Properly validte arguments for route deletion

Reported by: Liang Zhuo brightiup.zhuo@gmail.com
MFC after:	1 week
This commit is contained in:
gnn 2019-08-03 14:42:07 +00:00
parent 779520855e
commit 40bd736195

View File

@ -1590,6 +1590,8 @@ rtrequest1_fib(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt,
switch (req) {
case RTM_DELETE:
if (netmask) {
if (dst->sa_len > sizeof(mdst))
return (EINVAL);
rt_maskedcopy(dst, (struct sockaddr *)&mdst, netmask);
dst = (struct sockaddr *)&mdst;
}