diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2010-05-25 15:25:18 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2010-05-25 15:25:18 +0000 |
commit | aa7ecfd5cf391ca2ef15fad003de55fb109467a8 (patch) | |
tree | 9e05a987ad4966b0bce4fb98fdae9a0a65c975ae /sys/compat | |
parent | b261ad7a1ab784a63092100f5c91cd8bf4366cfb (diff) |
Zero out svr4_statvfs and svr4_statvfs64 before using and copy the
correct number of bytes into f_fstr. OK kettenis@ deraadt@ nicm@
Diffstat (limited to 'sys/compat')
-rw-r--r-- | sys/compat/svr4/svr4_misc.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/compat/svr4/svr4_misc.c b/sys/compat/svr4/svr4_misc.c index e4a038f2267..cbb705063a4 100644 --- a/sys/compat/svr4/svr4_misc.c +++ b/sys/compat/svr4/svr4_misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: svr4_misc.c,v 1.52 2010/04/28 21:31:59 kettenis Exp $ */ +/* $OpenBSD: svr4_misc.c,v 1.53 2010/05/25 15:25:17 millert Exp $ */ /* $NetBSD: svr4_misc.c,v 1.42 1996/12/06 03:22:34 christos Exp $ */ /* @@ -1121,6 +1121,7 @@ bsd_statfs_to_svr4_statvfs(bfs, sfs) const struct statfs *bfs; struct svr4_statvfs *sfs; { + bzero(sfs, sizeof(*sfs)); sfs->f_bsize = bfs->f_iosize; /* XXX */ sfs->f_frsize = bfs->f_bsize; sfs->f_blocks = bfs->f_blocks; @@ -1131,14 +1132,13 @@ bsd_statfs_to_svr4_statvfs(bfs, sfs) sfs->f_favail = bfs->f_ffree; sfs->f_fsid = bfs->f_fsid.val[0]; bcopy(bfs->f_fstypename, sfs->f_basetype, sizeof(sfs->f_basetype)); - sfs->f_flag = 0; if (bfs->f_flags & MNT_RDONLY) sfs->f_flag |= SVR4_ST_RDONLY; if (bfs->f_flags & MNT_NOSUID) sfs->f_flag |= SVR4_ST_NOSUID; sfs->f_namemax = MAXNAMLEN; - bcopy(bfs->f_fstypename, sfs->f_fstr, sizeof(sfs->f_fstr)); /* XXX */ - bzero(sfs->f_filler, sizeof(sfs->f_filler)); + bcopy(bfs->f_fstypename, sfs->f_fstr, + MIN(sizeof(sfs->f_fstypename), sizeof(sfs->f_fstr)); } @@ -1147,6 +1147,7 @@ bsd_statfs_to_svr4_statvfs64(bfs, sfs) const struct statfs *bfs; struct svr4_statvfs64 *sfs; { + bzero(sfs, sizeof(*sfs)); sfs->f_bsize = bfs->f_iosize; /* XXX */ sfs->f_frsize = bfs->f_bsize; sfs->f_blocks = bfs->f_blocks; @@ -1157,14 +1158,13 @@ bsd_statfs_to_svr4_statvfs64(bfs, sfs) sfs->f_favail = bfs->f_ffree; sfs->f_fsid = bfs->f_fsid.val[0]; bcopy(bfs->f_fstypename, sfs->f_basetype, sizeof(sfs->f_basetype)); - sfs->f_flag = 0; if (bfs->f_flags & MNT_RDONLY) sfs->f_flag |= SVR4_ST_RDONLY; if (bfs->f_flags & MNT_NOSUID) sfs->f_flag |= SVR4_ST_NOSUID; sfs->f_namemax = MAXNAMLEN; - bcopy(bfs->f_fstypename, sfs->f_fstr, sizeof(sfs->f_fstr)); /* XXX */ - bzero(sfs->f_filler, sizeof(sfs->f_filler)); + bcopy(bfs->f_fstypename, sfs->f_fstr, + MIN(sizeof(sfs->f_fstypename), sizeof(sfs->f_fstr)); } |