CVS commit: [netbsd-6-1] src/sys/compat/osf1

2015-11-15 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Nov 15 20:48:45 UTC 2015

Modified Files:
src/sys/compat/osf1 [netbsd-6-1]: osf1_socket.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1338):
sys/compat/osf1/osf1_socket.c: revision 1.21
easy kmem_alloc(0)
ok shm@


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.20.28.1 src/sys/compat/osf1/osf1_socket.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/osf1/osf1_socket.c
diff -u src/sys/compat/osf1/osf1_socket.c:1.20 src/sys/compat/osf1/osf1_socket.c:1.20.28.1
--- src/sys/compat/osf1/osf1_socket.c:1.20	Fri Apr 23 15:19:21 2010
+++ src/sys/compat/osf1/osf1_socket.c	Sun Nov 15 20:48:45 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: osf1_socket.c,v 1.20 2010/04/23 15:19:21 rmind Exp $ */
+/* $NetBSD: osf1_socket.c,v 1.20.28.1 2015/11/15 20:48:45 bouyer Exp $ */
 
 /*
  * Copyright (c) 1999 Christopher G. Demetriou.  All rights reserved.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: osf1_socket.c,v 1.20 2010/04/23 15:19:21 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: osf1_socket.c,v 1.20.28.1 2015/11/15 20:48:45 bouyer Exp $");
 
 #include 
 #include 
@@ -116,7 +116,7 @@ osf1_sys_sendmsg_xopen(struct lwp *l, co
 		return (EINVAL);
 
 	iov_len = bsd_msghdr.msg_iovlen;
-	if (iov_len > IOV_MAX)
+	if ((iov_len > IOV_MAX) || (iov_len == 0))
 		return EMSGSIZE;
 	bsd_iovec = kmem_alloc(iov_len * sizeof(struct iovec), KM_SLEEP);
 	bsd_msghdr.msg_iov = bsd_iovec;



CVS commit: [netbsd-6-1] src/sys/compat/osf1

2014-08-27 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Aug 27 15:02:27 UTC 2014

Modified Files:
src/sys/compat/osf1 [netbsd-6-1]: osf1_file.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1141):
sys/compat/osf1/osf1_file.c: revision 1.42
Ensure nbytes  0. Otherwise bad things may happen.
Compile-tested only.
ok christos@


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.41.22.1 src/sys/compat/osf1/osf1_file.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/osf1/osf1_file.c
diff -u src/sys/compat/osf1/osf1_file.c:1.41 src/sys/compat/osf1/osf1_file.c:1.41.22.1
--- src/sys/compat/osf1/osf1_file.c:1.41	Fri Jul 22 10:02:08 2011
+++ src/sys/compat/osf1/osf1_file.c	Wed Aug 27 15:02:27 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: osf1_file.c,v 1.41 2011/07/22 10:02:08 njoly Exp $ */
+/* $NetBSD: osf1_file.c,v 1.41.22.1 2014/08/27 15:02:27 msaitoh Exp $ */
 
 /*
  * Copyright (c) 1999 Christopher G. Demetriou.  All rights reserved.
@@ -58,7 +58,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: osf1_file.c,v 1.41 2011/07/22 10:02:08 njoly Exp $);
+__KERNEL_RCSID(0, $NetBSD: osf1_file.c,v 1.41.22.1 2014/08/27 15:02:27 msaitoh Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_syscall_debug.h
@@ -133,7 +133,7 @@ osf1_sys_getdirentries(struct lwp *l, co
 	/* {
 		syscallarg(int) fd;
 		syscallarg(char *) buf;
-		syscallarg(u_int) nbytes;
+		syscallarg(int) nbytes;
 		syscallarg(long *) basep;
 	} */
 	struct dirent *bdp;
@@ -151,6 +151,11 @@ osf1_sys_getdirentries(struct lwp *l, co
 	off_t *cookiebuf = NULL, *cookie;
 	int ncookies, fd;
 
+	if (SCARG(uap, nbytes)  0)
+		return EINVAL;
+	if (SCARG(uap, nbytes) == 0)
+		return 0;
+
 	fd = SCARG(uap, fd);
 	if ((error = fd_getvnode(fd, fp)) != 0)
 		return (error);