Fix possible off by one in b_save allocation size.

This commit is contained in:
David Greenman 1994-12-18 03:05:49 +00:00
parent 2ef751df5e
commit 8a8d90d871
1 changed files with 2 additions and 2 deletions

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_cluster.c 8.7 (Berkeley) 2/13/94
* $Id: vfs_cluster.c,v 1.5 1994/09/24 18:31:45 davidg Exp $
* $Id: vfs_cluster.c,v 1.6 1994/10/08 22:33:41 phk Exp $
*/
#include <sys/param.h>
@ -310,7 +310,7 @@ cluster_rbuild(vp, filesize, bp, lbn, blkno, size, run, flags)
if (bp->b_flags & (B_DONE | B_DELWRI))
return (bp);
b_save = malloc(sizeof(struct buf *) * run + sizeof(struct cluster_save),
b_save = malloc(sizeof(struct buf *) * (run + 1) + sizeof(struct cluster_save),
M_SEGMENT, M_WAITOK);
b_save->bs_bufsize = b_save->bs_bcount = size;
b_save->bs_nchildren = 0;