Commit d3b45038 authored by Pascal Störzbach's avatar Pascal Störzbach Committed by Kevin Wolf
Browse files

ext2: Check for null pointer before using it

! Copy from buffer to cache block only after verifying whether the
  cache block is valid.
Signed-off-by: default avatarGurgel100 <>
Signed-off-by: Kevin Wolf's avatarKevin Wolf <>
parent d0e275eb
......@@ -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;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment