Skip to content

Commit 1746268

Browse files
committed
[[ CID 15622 ]] Fix dereference after null check issue.
1 parent 1cef2b0 commit 1746268

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

engine/src/ibmp.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2412,7 +2412,7 @@ static bool xpm_read_v1_header(IO_handle p_stream, char x_line[XPM_MAX_LINE], ui
24122412

24132413
t_success = t_name != nil && t_width != 0 && t_height != 0;
24142414

2415-
if (MCCStringFirstIndexOf(x_line, t_name, t_colors_index))
2415+
if (t_success && MCCStringFirstIndexOf(x_line, t_name, t_colors_index))
24162416
{
24172417
t_colors_index += MCCStringLength(t_name);
24182418
// may be a monochrome table, in which case we keep looking
@@ -2424,7 +2424,8 @@ static bool xpm_read_v1_header(IO_handle p_stream, char x_line[XPM_MAX_LINE], ui
24242424
}
24252425
}
24262426

2427-
t_success = IO_NORMAL == IO_fgets(x_line, XPM_MAX_LINE, p_stream);
2427+
if (t_success)
2428+
t_success = IO_NORMAL == IO_fgets(x_line, XPM_MAX_LINE, p_stream);
24282429
}
24292430

24302431
if (t_success)

0 commit comments

Comments
 (0)