Module Name: src Committed By: msaitoh Date: Wed Aug 27 15:02:39 UTC 2014
Modified Files: src/sys/compat/osf1 [netbsd-6-0]: 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.14.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.14.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:39 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.14.1 2014/08/27 15:02:39 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.14.1 2014/08/27 15:02:39 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);