summaryrefslogtreecommitdiffstats
path: root/sys/compat/linux/linux_socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/compat/linux/linux_socket.c')
-rw-r--r--sys/compat/linux/linux_socket.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c
index 9ae7662..950e170 100644
--- a/sys/compat/linux/linux_socket.c
+++ b/sys/compat/linux/linux_socket.c
@@ -452,8 +452,9 @@ linux_sendto_hdrincl(struct thread *td, struct linux_sendto_args *linux_args)
struct iovec aiov[1];
int error;
- /* Check the packet isn't too small before we mess with it */
- if (linux_args->len < linux_ip_copysize)
+ /* Check that the packet isn't too big or too small. */
+ if (linux_args->len < linux_ip_copysize ||
+ linux_args->len > IP_MAXPACKET)
return (EINVAL);
packet = (struct ip *)malloc(linux_args->len, M_TEMP, M_WAITOK);
OpenPOWER on IntegriCloud