Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-6]: src Pull up following revision(s) (requested by manu in ticke...



details:   https://anonhg.NetBSD.org/src/rev/f45f949a9747
branches:  netbsd-6
changeset: 776752:f45f949a9747
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Mon Nov 03 19:48:14 2014 +0000

description:
Pull up following revision(s) (requested by manu in ticket #1150):
        lib/libc/sys/truncate.2: revision 1.27
        sys/kern/vfs_syscalls.c: revision 1.484
Follow OpenGroup online documents for truncate[1] and ftruncate[2].
Fail with EINVAL for length argument negative values.
[1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/truncate.html
[2] http://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html

diffstat:

 lib/libc/sys/truncate.2 |   8 ++++++--
 sys/kern/vfs_syscalls.c |  10 ++++++++--
 2 files changed, 14 insertions(+), 4 deletions(-)

diffs (67 lines):

diff -r 72f53fff78a1 -r f45f949a9747 lib/libc/sys/truncate.2
--- a/lib/libc/sys/truncate.2   Mon Nov 03 19:42:33 2014 +0000
+++ b/lib/libc/sys/truncate.2   Mon Nov 03 19:48:14 2014 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: truncate.2,v 1.26 2010/05/31 12:16:20 njoly Exp $
+.\"    $NetBSD: truncate.2,v 1.26.8.1 2014/11/03 19:48:14 msaitoh Exp $
 .\"
 .\" Copyright (c) 1983, 1991, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"     @(#)truncate.2 8.1 (Berkeley) 6/4/93
 .\"
-.Dd March 16, 2008
+.Dd June 14, 2014
 .Dt TRUNCATE 2
 .Os
 .Sh NAME
@@ -76,6 +76,10 @@
 .Fn ftruncate
 are:
 .Bl -tag -width Er
+.It Bq Er EINVAL
+The
+.Fa length
+argument was less than 0.
 .It Bq Er EISDIR
 The named file is a directory.
 .It Bq Er EROFS
diff -r 72f53fff78a1 -r f45f949a9747 sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c   Mon Nov 03 19:42:33 2014 +0000
+++ b/sys/kern/vfs_syscalls.c   Mon Nov 03 19:48:14 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_syscalls.c,v 1.449.2.3 2014/04/21 10:14:17 bouyer Exp $    */
+/*     $NetBSD: vfs_syscalls.c,v 1.449.2.4 2014/11/03 19:48:14 msaitoh Exp $   */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.449.2.3 2014/04/21 10:14:17 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.449.2.4 2014/11/03 19:48:14 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -3637,6 +3637,9 @@
        struct vattr vattr;
        int error;
 
+       if (SCARG(uap, length) < 0)
+               return EINVAL;
+
        error = namei_simple_user(SCARG(uap, path),
                                NSM_FOLLOW_TRYEMULROOT, &vp);
        if (error != 0)
@@ -3671,6 +3674,9 @@
        file_t *fp;
        int error;
 
+       if (SCARG(uap, length) < 0)
+               return EINVAL;
+
        /* fd_getvnode() will use the descriptor for us */
        if ((error = fd_getvnode(SCARG(uap, fd), &fp)) != 0)
                return (error);



Home | Main Index | Thread Index | Old Index