Source-Changes-HG archive

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

[src/trunk]: src/sys/compat Fix copyout overflows in fhstat, found by the LGT...



details:   https://anonhg.NetBSD.org/src/rev/20cc175bfa6a
branches:  trunk
changeset: 744378:20cc175bfa6a
user:      maxv <maxv%NetBSD.org@localhost>
date:      Fri Jan 31 09:01:23 2020 +0000

description:
Fix copyout overflows in fhstat, found by the LGTM bot. Not a big problem
since this syscall is privileged.

diffstat:

 sys/compat/common/vfs_syscalls_30.c      |  6 +++---
 sys/compat/netbsd32/netbsd32_compat_30.c |  6 +++---
 sys/compat/netbsd32/netbsd32_fs.c        |  6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)

diffs (81 lines):

diff -r 03113dbdae8b -r 20cc175bfa6a sys/compat/common/vfs_syscalls_30.c
--- a/sys/compat/common/vfs_syscalls_30.c       Fri Jan 31 08:55:38 2020 +0000
+++ b/sys/compat/common/vfs_syscalls_30.c       Fri Jan 31 09:01:23 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_syscalls_30.c,v 1.40 2020/01/17 20:08:06 ad Exp $  */
+/*     $NetBSD: vfs_syscalls_30.c,v 1.41 2020/01/31 09:01:23 maxv Exp $        */
 
 /*-
  * Copyright (c) 2005, 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_30.c,v 1.40 2020/01/17 20:08:06 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_30.c,v 1.41 2020/01/31 09:01:23 maxv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -190,7 +190,7 @@
        if (error)
                return (error);
        cvtstat(&osb, &sb);
-       error = copyout(&osb, SCARG(uap, sb), sizeof(sb));
+       error = copyout(&osb, SCARG(uap, sb), sizeof(osb));
        return (error);
 }
 
diff -r 03113dbdae8b -r 20cc175bfa6a sys/compat/netbsd32/netbsd32_compat_30.c
--- a/sys/compat/netbsd32/netbsd32_compat_30.c  Fri Jan 31 08:55:38 2020 +0000
+++ b/sys/compat/netbsd32/netbsd32_compat_30.c  Fri Jan 31 09:01:23 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_compat_30.c,v 1.34 2020/01/17 20:08:06 ad Exp $       */
+/*     $NetBSD: netbsd32_compat_30.c,v 1.35 2020/01/31 09:01:23 maxv Exp $     */
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_30.c,v 1.34 2020/01/17 20:08:06 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_30.c,v 1.35 2020/01/31 09:01:23 maxv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include <opt_ntp.h>
@@ -199,7 +199,7 @@
        if (error)
                return (error);
        netbsd32_from___stat13(&sb, &sb32);
-       error = copyout(&sb32, SCARG_P32(uap, sb), sizeof(sb));
+       error = copyout(&sb32, SCARG_P32(uap, sb), sizeof(sb32));
        return (error);
 }
 
diff -r 03113dbdae8b -r 20cc175bfa6a sys/compat/netbsd32/netbsd32_fs.c
--- a/sys/compat/netbsd32/netbsd32_fs.c Fri Jan 31 08:55:38 2020 +0000
+++ b/sys/compat/netbsd32/netbsd32_fs.c Fri Jan 31 09:01:23 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_fs.c,v 1.85 2019/09/26 01:32:09 christos Exp $        */
+/*     $NetBSD: netbsd32_fs.c,v 1.86 2020/01/31 09:01:23 maxv Exp $    */
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.c,v 1.85 2019/09/26 01:32:09 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.c,v 1.86 2020/01/31 09:01:23 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -630,7 +630,7 @@
        error = do_fhstat(l, SCARG_P32(uap, fhp), SCARG(uap, fh_size), &sb);
        if (error == 0) {
                netbsd32_from_stat(&sb, &sb32);
-               error = copyout(&sb32, SCARG_P32(uap, sb), sizeof(sb));
+               error = copyout(&sb32, SCARG_P32(uap, sb), sizeof(sb32));
        }
        return error;
 }



Home | Main Index | Thread Index | Old Index