Commit caf78f03 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 <baesae@hotmail.ch>
Signed-off-by: Kevin Wolf's avatarKevin Wolf <kevin@tyndur.org>
parent 877015dc
No related merge requests found
Showing with 2 additions and 1 deletion
+2 -1
......@@ -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