From: Theodore Ts'o Date: Mon, 17 Sep 2001 14:38:06 +0000 (-0400) Subject: mke2fs.c (zap_sector): Allocate sufficient space for zero-filled X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=3f85f65c98183c3871e24f285e5b3e1e97afd9f5;p=tools%2Fe2fsprogs.git mke2fs.c (zap_sector): Allocate sufficient space for zero-filled buffer. --- diff --git a/misc/ChangeLog b/misc/ChangeLog index d1986b0..c515f4f 100644 --- a/misc/ChangeLog +++ b/misc/ChangeLog @@ -1,3 +1,8 @@ +2001-09-13 Theodore Tso + + * mke2fs.c (zap_sector): Allocate sufficient space for + zero-filled buffer. + 2001-09-02 Theodore Tso * Release of E2fsprogs 1.24a diff --git a/misc/mke2fs.c b/misc/mke2fs.c index bb5c249..1d9f7ff 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -550,14 +550,16 @@ static void reserve_inodes(ext2_filsys fs) static void zap_sector(ext2_filsys fs, int sect, int nsect) { - char buf[512]; + char *buf; int retval; - memset(buf, 0, 512); + buf = malloc(512*nsect); + memset(buf, 0, 512*nsect); io_channel_set_blksize(fs->io, 512); retval = io_channel_write_blk(fs->io, sect, -512*nsect, buf); io_channel_set_blksize(fs->io, fs->blocksize); + free(buf); if (retval) printf(_("Warning: could not erase sector %d: %s\n"), sect, error_message(retval));