diff --git a/sys/net/route.c b/sys/net/route.c index 85a4f4264502..1dd12da6ded1 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -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; }