svn commit: r347537 - head/sys/compat/linux

Dmitry Chagin dchagin at FreeBSD.org
Mon May 13 18:14:21 UTC 2019


Author: dchagin
Date: Mon May 13 18:14:20 2019
New Revision: 347537
URL: https://svnweb.freebsd.org/changeset/base/347537

Log:
  Linuxulator getpeername() returns EINVAL in case then namelen less then 0.
  
  MFC after:	2 weeks

Modified:
  head/sys/compat/linux/linux_socket.c

Modified: head/sys/compat/linux/linux_socket.c
==============================================================================
--- head/sys/compat/linux/linux_socket.c	Mon May 13 17:53:03 2019	(r347536)
+++ head/sys/compat/linux/linux_socket.c	Mon May 13 18:14:20 2019	(r347537)
@@ -722,6 +722,8 @@ linux_getpeername(struct thread *td, struct linux_getp
 	error = copyin(PTRIN(args->namelen), &len, sizeof(len));
 	if (error != 0)
 		return (error);
+	if (len < 0)
+		return (EINVAL);
 
 	error = kern_getpeername(td, args->s, &sa, &len);
 	if (error != 0)


More information about the svn-src-head mailing list