Author: trasz
Date: Mon Aug 24 15:49:37 2020
New Revision: 364694
URL: https://svnweb.freebsd.org/changeset/base/364694

Log:
  MFC r347537 by dchagin:
  
  Linuxulator getpeername() returns EINVAL in case then namelen less then 0.

Modified:
  stable/12/sys/compat/linux/linux_socket.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/compat/linux/linux_socket.c
==============================================================================
--- stable/12/sys/compat/linux/linux_socket.c   Mon Aug 24 15:45:42 2020        
(r364693)
+++ stable/12/sys/compat/linux/linux_socket.c   Mon Aug 24 15:49:37 2020        
(r364694)
@@ -729,6 +729,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)
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to