This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master in repository gfs2-utils.
commit fc8280d33774e67ef60f58e9c66c7842a46df124 Author: Andrew Price anprice@redhat.com AuthorDate: Tue Oct 5 10:54:55 2021 +0100
gfs2_edit: Fix segfault in hexdump()
The S_ISDIR check wasn't in the correct level of parentheses so the condition could be evaluated when di == NULL, causing a segfault.
Split that clause out to make it more clear and correct the parentheses.
Signed-off-by: Andrew Price anprice@redhat.com --- gfs2/edit/hexedit.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c index 302f0843..798639b5 100644 --- a/gfs2/edit/hexedit.c +++ b/gfs2/edit/hexedit.c @@ -624,12 +624,15 @@ static int hexdump(uint64_t startaddr, uint64_t len, int trunc_zeros, } if (m && cursor_line) { const uint32_t block_type = m->mh_type; + int isdir; + + isdir = ((block_type == GFS2_METATYPE_DI) && + (((struct gfs2_dinode*)bh->b_data)->di_height || + S_ISDIR(be32_to_cpu(di->di_mode))));
if (block_type == GFS2_METATYPE_IN || - block_type == GFS2_METATYPE_LD || - ((block_type == GFS2_METATYPE_DI) && - ((struct gfs2_dinode*)bh->b_data)->di_height) || - S_ISDIR(be32_to_cpu(di->di_mode))) { + block_type == GFS2_METATYPE_LD || isdir) { + ptroffset = edit_row[dmode] * 16 + edit_col[dmode];
cluster-commits@lists.fedorahosted.org