Source-Changes-HG archive

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

[src/trunk]: src/sys/fs/msdosfs We don't actually want to round the number of...



details:   https://anonhg.NetBSD.org/src/rev/4f573db83760
branches:  trunk
changeset: 781855:4f573db83760
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Wed Oct 03 23:32:43 2012 +0000

description:
We don't actually want to round the number of elements in the bitmap
down.  Fixes a self-inflicted buffer overrun.

(This was detected by chance that the top of the bitmap coincided with
a page boundary.)

diffstat:

 sys/fs/msdosfs/msdosfs_vfsops.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r da756278ecba -r 4f573db83760 sys/fs/msdosfs/msdosfs_vfsops.c
--- a/sys/fs/msdosfs/msdosfs_vfsops.c   Wed Oct 03 22:28:20 2012 +0000
+++ b/sys/fs/msdosfs/msdosfs_vfsops.c   Wed Oct 03 23:32:43 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msdosfs_vfsops.c,v 1.96 2012/07/07 16:18:50 tsutsui Exp $      */
+/*     $NetBSD: msdosfs_vfsops.c,v 1.97 2012/10/03 23:32:43 jakllsch Exp $     */
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.96 2012/07/07 16:18:50 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.97 2012/10/03 23:32:43 jakllsch Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -771,7 +771,7 @@
         * Allocate memory for the bitmap of allocated clusters, and then
         * fill it in.
         */
-       pmp->pm_inusemap = malloc(((pmp->pm_maxcluster + N_INUSEBITS - 1)
+       pmp->pm_inusemap = malloc(((pmp->pm_maxcluster + N_INUSEBITS)
                                   / N_INUSEBITS)
                                  * sizeof(*pmp->pm_inusemap),
                                  M_MSDOSFSFAT, M_WAITOK);



Home | Main Index | Thread Index | Old Index