linux(4): Limit user-supplied sockaddr length in recvfrom().

Differential Revision:	https://reviews.freebsd.org/D34726
This commit is contained in:
Dmitry Chagin 2022-04-11 23:32:28 +03:00
parent 68bfaefb3d
commit bb0f644cd6

View File

@ -1272,6 +1272,7 @@ linux_recvfrom(struct thread *td, struct linux_recvfrom_args *args)
return (error);
if (fromlen < 0)
return (EINVAL);
fromlen = min(fromlen, SOCK_MAXADDRLEN);
sa = malloc(fromlen, M_SONAME, M_WAITOK);
} else {
fromlen = 0;