mirror of https://github.com/vitalif/e2fsprogs
libext2fs: reset the size of the zeroing buffer
When a ext2_filsys is freed, ext2fs_zero_blocks2() frees the buffer but does not reset its size. If this function is later called with a new ext2_filsys, the code assumes that the buffer is still valid and return a NULL pointer. Valgrind output: ==188948== Syscall param pwrite64(buf) points to unaddressable byte(s) ==188948== at 0x4E46D03: __pwrite_nocancel (syscall-template.S:81) ==188948== by 0x1254EC: raw_write_blk (unix_io.c:240) ==188948== by 0x124AAB: unix_write_blk64 (unix_io.c:850) ==188948== by 0x122893: ext2fs_zero_blocks2 (mkjournal.c:204) Signed-off-by: Adrien Schildknecht <adriens@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>next
parent
3d6fc97483
commit
5cc6db0c82
|
@ -162,6 +162,7 @@ errcode_t ext2fs_zero_blocks2(ext2_filsys fs, blk64_t blk, int num,
|
|||
if (buf) {
|
||||
free(buf);
|
||||
buf = 0;
|
||||
stride_length = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue