Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/lfs fix buffer overflow/KASSERT when cookies are sup...



details:   https://anonhg.NetBSD.org/src/rev/c394e3e32739
branches:  trunk
changeset: 825886:c394e3e32739
user:      maya <maya%NetBSD.org@localhost>
date:      Fri Aug 04 07:27:42 2017 +0000

description:
fix buffer overflow/KASSERT when cookies are supplied
lfs no longer uses the ffs-style struct direct, use the correct minimum
size

from dholland
XXX more wrong

diffstat:

 sys/ufs/lfs/ulfs_vnops.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r bcdbf5511c8a -r c394e3e32739 sys/ufs/lfs/ulfs_vnops.c
--- a/sys/ufs/lfs/ulfs_vnops.c  Fri Aug 04 07:27:08 2017 +0000
+++ b/sys/ufs/lfs/ulfs_vnops.c  Fri Aug 04 07:27:42 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ulfs_vnops.c,v 1.49 2017/06/10 05:29:36 maya Exp $     */
+/*     $NetBSD: ulfs_vnops.c,v 1.50 2017/08/04 07:27:42 maya Exp $     */
 /*  from NetBSD: ufs_vnops.c,v 1.232 2016/05/19 18:32:03 riastradh Exp  */
 
 /*-
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ulfs_vnops.c,v 1.49 2017/06/10 05:29:36 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ulfs_vnops.c,v 1.50 2017/08/04 07:27:42 maya Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_lfs.h"
@@ -826,7 +826,7 @@
 
        off = uio->uio_offset;
        if (ap->a_cookies) {
-               ccount = rcount / _DIRENT_RECLEN(ndp, 1);
+               ccount = rcount / LFS_DIRECTSIZ(fs, 1);
                ccp = *(ap->a_cookies) = malloc(ccount * sizeof(*ccp),
                    M_TEMP, M_WAITOK);
        } else {



Home | Main Index | Thread Index | Old Index