Source-Changes-HG archive

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

[src/netbsd-8]: src/sys/compat/osf1 Apply patch, requested by riastradh in ti...



details:   https://anonhg.NetBSD.org/src/rev/9f62e6d2e743
branches:  netbsd-8
changeset: 376551:9f62e6d2e743
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Jun 21 21:09:28 2023 +0000

description:
Apply patch, requested by riastradh in ticket #1837:

        sys/compat/osf1/osf1_cvt.c
        sys/compat/osf1/osf1_file.c
        sys/compat/osf1/osf1_misc.c

Memset structures to zero before passing them to copyout to expose them
to userland.
No equivalent change in newer branches, commpat/osf1 has been deleted.

diffstat:

 sys/compat/osf1/osf1_cvt.c  |  11 ++++++++---
 sys/compat/osf1/osf1_file.c |   5 +++--
 sys/compat/osf1/osf1_misc.c |   6 ++++--
 3 files changed, 15 insertions(+), 7 deletions(-)

diffs (113 lines):

diff -r 126a0c825591 -r 9f62e6d2e743 sys/compat/osf1/osf1_cvt.c
--- a/sys/compat/osf1/osf1_cvt.c        Wed Jun 21 21:04:01 2023 +0000
+++ b/sys/compat/osf1/osf1_cvt.c        Wed Jun 21 21:09:28 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: osf1_cvt.c,v 1.28 2013/11/04 16:52:08 christos Exp $ */
+/* $NetBSD: osf1_cvt.c,v 1.28.22.1 2023/06/21 21:09:28 martin Exp $ */
 
 /*
  * Copyright (c) 1999 Christopher G. Demetriou.  All rights reserved.
@@ -58,7 +58,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: osf1_cvt.c,v 1.28 2013/11/04 16:52:08 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: osf1_cvt.c,v 1.28.22.1 2023/06/21 21:09:28 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -463,6 +463,8 @@ void
 osf1_cvt_rusage_from_native(const struct rusage *ru, struct osf1_rusage *oru)
 {
 
+       memset(oru, 0, sizeof(*oru));
+
        oru->ru_utime.tv_sec = ru->ru_utime.tv_sec;
        oru->ru_utime.tv_usec = ru->ru_utime.tv_usec;
 
@@ -492,6 +494,8 @@ void
 osf1_cvt_sigaction_from_native(const struct sigaction *bsa, struct osf1_sigaction *osa)
 {
 
+       memset(osa, 0, sizeof(*osa));
+
        osa->osf1_sa_handler = bsa->sa_handler;
        osf1_cvt_sigset_from_native(&bsa->sa_mask, &osa->osf1_sa_mask);
 
@@ -553,6 +557,7 @@ void
 osf1_cvt_stat_from_native(const struct stat *st, struct osf1_stat *ost)
 {
 
+       memset(ost, 0, sizeof(*ost));
        ost->st_dev = osf1_cvt_dev_from_native(st->st_dev);
        ost->st_ino = st->st_ino;
        ost->st_mode = st->st_mode;
@@ -602,7 +607,7 @@ void
 osf1_cvt_statfs_from_native(const struct statvfs *bsfs, struct osf1_statfs *osfs)
 {
 
-       memset(osfs, 0, sizeof (struct osf1_statfs));
+       memset(osfs, 0, sizeof(*osfs));
        if (!strncmp(MOUNT_FFS, bsfs->f_fstypename, sizeof(bsfs->f_fstypename)))
                osfs->f_type = OSF1_MOUNT_UFS;
        else if (!strncmp(MOUNT_NFS, bsfs->f_fstypename, sizeof(bsfs->f_fstypename)))
diff -r 126a0c825591 -r 9f62e6d2e743 sys/compat/osf1/osf1_file.c
--- a/sys/compat/osf1/osf1_file.c       Wed Jun 21 21:04:01 2023 +0000
+++ b/sys/compat/osf1/osf1_file.c       Wed Jun 21 21:09:28 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: osf1_file.c,v 1.43.12.1 2017/08/09 05:12:18 snj Exp $ */
+/* $NetBSD: osf1_file.c,v 1.43.12.2 2023/06/21 21:09:28 martin 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.43.12.1 2017/08/09 05:12:18 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: osf1_file.c,v 1.43.12.2 2023/06/21 21:09:28 martin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_syscall_debug.h"
@@ -218,6 +218,7 @@ again:
                        inp += reclen;  /* it is a hole; squish it out */
                        continue;
                }
+               memset(&idb, 0, sizeof(idb));
                osf1_reclen = OSF1_RECLEN(&idb, bdp->d_namlen);
                if (reclen > len || resid < osf1_reclen) {
                        /* entry too big for buffer, so just stop */
diff -r 126a0c825591 -r 9f62e6d2e743 sys/compat/osf1/osf1_misc.c
--- a/sys/compat/osf1/osf1_misc.c       Wed Jun 21 21:04:01 2023 +0000
+++ b/sys/compat/osf1/osf1_misc.c       Wed Jun 21 21:09:28 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: osf1_misc.c,v 1.87 2016/11/10 17:00:51 christos Exp $ */
+/* $NetBSD: osf1_misc.c,v 1.87.8.1 2023/06/21 21:09:28 martin Exp $ */
 
 /*
  * Copyright (c) 1999 Christopher G. Demetriou.  All rights reserved.
@@ -58,7 +58,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: osf1_misc.c,v 1.87 2016/11/10 17:00:51 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: osf1_misc.c,v 1.87.8.1 2023/06/21 21:09:28 martin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_syscall_debug.h"
@@ -338,6 +338,7 @@ osf1_sys_uname(struct lwp *l, const stru
         const char *cp;
         char *dp, *ep;
 
+       memset(&u, 0, sizeof(u));
         strncpy(u.sysname, ostype, sizeof(u.sysname));
         strncpy(u.nodename, hostname, sizeof(u.nodename));
         strncpy(u.release, osrelease, sizeof(u.release));
@@ -383,6 +384,7 @@ osf1_sys_usleep_thread(struct lwp *l, co
                if (endtv.tv_sec < 0 || endtv.tv_usec < 0)
                        endtv.tv_sec = endtv.tv_usec = 0;
 
+               memset(&endotv, 0, sizeof(endotv));
                endotv.tv_sec = endtv.tv_sec;
                endotv.tv_usec = endtv.tv_usec;
                error = copyout(&endotv, SCARG(uap, slept), sizeof endotv);



Home | Main Index | Thread Index | Old Index