[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cdi-devel] [PATCH] ext2: Check for null pointer before using it
! Copy from buffer to cache block after verifying wether cache block is valid.
Signed-off-by: Gurgel100 <baesae@xxxxxxxxxx>
---
ext2/libext2/inode.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/ext2/libext2/inode.c b/ext2/libext2/inode.c
index e697308..a74d526 100644
--- a/ext2/libext2/inode.c
+++ b/ext2/libext2/inode.c
@@ -635,10 +635,11 @@ static int writeblk(ext2_inode_t* inode, uint64_t block, const void* buf)
}
b = fs->cache_block(fs->cache_handle, block_offset / block_size, 1);
- memcpy(b->data, buf, block_size);
if (!b) {
return 0;
}
+
+ memcpy(b->data, buf, block_size);
fs->cache_block_free(b, 1);
return 1;
--
2.7.4