From: Michael Forney Date: Sun, 5 Apr 2020 04:53:46 +0000 (-0700) Subject: libext2fs: avoid pointer arithmetic on `void *` X-Git-Tag: v1.45.7~49 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=1bc7feaef5685183d5e0301ae9f8d8310487ba12;p=tools%2Fe2fsprogs.git libext2fs: avoid pointer arithmetic on `void *` The pointer operand to the binary `+` operator must be to a complete object type. Signed-off-by: Michael Forney Reviewed-by: Andreas Dilger Signed-off-by: Theodore Ts'o --- diff --git a/lib/ext2fs/csum.c b/lib/ext2fs/csum.c index a717258..54b53a3 100644 --- a/lib/ext2fs/csum.c +++ b/lib/ext2fs/csum.c @@ -274,7 +274,7 @@ static errcode_t __get_dirent_tail(ext2_filsys fs, rec_len = translate(d->rec_len); } - if ((void *)d > ((void *)dirent + fs->blocksize)) + if ((char *)d > ((char *)dirent + fs->blocksize)) return EXT2_ET_DIR_CORRUPTED; if (d != top) return EXT2_ET_DIR_NO_SPACE_FOR_CSUM;