Source-Changes-HG archive

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

[src/netbsd-8]: src/sys/compat/common Pull up following revision(s) (requeste...



details:   https://anonhg.NetBSD.org/src/rev/98c8baf59b9f
branches:  netbsd-8
changeset: 434481:98c8baf59b9f
user:      snj <snj%NetBSD.org@localhost>
date:      Sun Dec 10 09:36:36 2017 +0000

description:
Pull up following revision(s) (requested by christos in ticket #418):
        sys/compat/common/vfs_syscalls_12.c: revision 1.35
        sys/compat/common/vfs_syscalls_43.c: revision 1.62
Make code look the same, in particular zero out the rest of the directory
record.

diffstat:

 sys/compat/common/vfs_syscalls_12.c |  14 +++++++++-----
 sys/compat/common/vfs_syscalls_43.c |  15 ++++++++++-----
 2 files changed, 19 insertions(+), 10 deletions(-)

diffs (85 lines):

diff -r 2c2ffd416590 -r 98c8baf59b9f sys/compat/common/vfs_syscalls_12.c
--- a/sys/compat/common/vfs_syscalls_12.c       Sun Dec 10 09:35:03 2017 +0000
+++ b/sys/compat/common/vfs_syscalls_12.c       Sun Dec 10 09:36:36 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_syscalls_12.c,v 1.33.8.1 2017/08/09 05:12:18 snj Exp $     */
+/*     $NetBSD: vfs_syscalls_12.c,v 1.33.8.2 2017/12/10 09:36:36 snj Exp $     */
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_12.c,v 1.33.8.1 2017/08/09 05:12:18 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_12.c,v 1.33.8.2 2017/12/10 09:36:36 snj Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -183,6 +183,10 @@
                                off += reclen;
                        continue;
                }
+               if (bdp->d_namlen >= sizeof(idb.d_name))
+                       idb.d_namlen = sizeof(idb.d_name) - 1;
+               else
+                       idb.d_namlen = bdp->d_namlen;
                old_reclen = _DIRENT_RECLEN(&idb, bdp->d_namlen);
                if (reclen > len || resid < old_reclen) {
                        /* entry too big for buffer, so just stop */
@@ -197,9 +201,9 @@
                idb.d_fileno = (uint32_t)bdp->d_fileno;
                idb.d_reclen = (uint16_t)old_reclen;
                idb.d_type = (uint8_t)bdp->d_type;
-               idb.d_namlen = (uint8_t)bdp->d_namlen;
-               memcpy(idb.d_name, bdp->d_name, MIN(sizeof(idb.d_name),
-                   bdp->d_namlen));
+               (void)memcpy(idb.d_name, bdp->d_name, idb.d_namlen);
+               memset(idb.d_name + idb.d_namlen, 0,
+                   idb.d_reclen - _DIRENT_NAMEOFF(&idb) - idb.d_namlen);
                if ((error = copyout(&idb, outp, old_reclen)))
                        goto out;
                /* advance past this real entry */
diff -r 2c2ffd416590 -r 98c8baf59b9f sys/compat/common/vfs_syscalls_43.c
--- a/sys/compat/common/vfs_syscalls_43.c       Sun Dec 10 09:35:03 2017 +0000
+++ b/sys/compat/common/vfs_syscalls_43.c       Sun Dec 10 09:36:36 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_syscalls_43.c,v 1.59.8.1 2017/08/09 05:12:18 snj Exp $     */
+/*     $NetBSD: vfs_syscalls_43.c,v 1.59.8.2 2017/12/10 09:36:36 snj Exp $     */
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.59.8.1 2017/08/09 05:12:18 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.59.8.2 2017/12/10 09:36:36 snj Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -463,6 +463,10 @@
                                off += reclen;
                        continue;
                }
+               if (bdp->d_namlen >= sizeof(idb.d_name))
+                       idb.d_namlen = sizeof(idb.d_name) - 1;
+               else
+                       idb.d_namlen = bdp->d_namlen;
                old_reclen = _DIRENT_RECLEN(&idb, bdp->d_namlen);
                if (reclen > len || resid < old_reclen) {
                        /* entry too big for buffer, so just stop */
@@ -476,9 +480,10 @@
                 */
                idb.d_fileno = (uint32_t)bdp->d_fileno;
                idb.d_reclen = (uint16_t)old_reclen;
-               idb.d_namlen = (uint16_t)bdp->d_namlen;
-               memcpy(idb.d_name, bdp->d_name, MIN(sizeof(idb.d_name),
-                   idb.d_namlen));
+               idb.d_fileno = (uint32_t)bdp->d_fileno;
+               (void)memcpy(idb.d_name, bdp->d_name, idb.d_namlen);
+               memset(idb.d_name + idb.d_namlen, 0,
+                   idb.d_reclen - _DIRENT_NAMEOFF(&idb) - idb.d_namlen);
                if ((error = copyout(&idb, outp, old_reclen)))
                        goto out;
                /* advance past this real entry */



Home | Main Index | Thread Index | Old Index