From baesae at hotmail.ch Thu May 4 15:50:41 2017 From: baesae at hotmail.ch (=?iso-8859-1?Q?Pascal_St=F6rzbach?=) Date: Thu, 4 May 2017 13:50:41 +0000 Subject: [cdi-devel] [PATCH] ext2: Check for null pointer before using it Message-ID: ! Copy from buffer to cache block after verifying wether cache block is valid. Signed-off-by: Gurgel100 --- 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 From kevin at tyndur.org Sun May 7 18:45:42 2017 From: kevin at tyndur.org (Kevin Wolf) Date: Sun, 7 May 2017 18:45:42 +0200 Subject: [cdi-devel] [PATCH] ext2: Check for null pointer before using it In-Reply-To: References: Message-ID: <20170507164541.GA5674@silvanus.fritz.box> On Thu, May 04, 2017 at 01:50:41PM +0000, Pascal St?rzbach wrote: > ! Copy from buffer to cache block after verifying wether cache block is valid. > > Signed-off-by: Gurgel100 Thanks, applied to libext2, CDI and tyndur. Kevin