mke2fs.c (zap_sector): Allocate sufficient space for zero-filled
buffer.
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 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));