Skip to content

Commit 3b0c18a

Browse files
stefanbellergitster
authored andcommitted
diff: fix a possible null pointer dereference
The condition in the ternary operator was wrong, hence the wrong char pointer could be used as the parameter for show_submodule_summary. one->path may be null, but we definitely need a non null path given to the function. Signed-off-by: Stefan Beller <[email protected]> Acked-By: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c189c4f commit 3b0c18a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

diff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2252,7 +2252,7 @@ static void builtin_diff(const char *name_a,
22522252
(!two->mode || S_ISGITLINK(two->mode))) {
22532253
const char *del = diff_get_color_opt(o, DIFF_FILE_OLD);
22542254
const char *add = diff_get_color_opt(o, DIFF_FILE_NEW);
2255-
show_submodule_summary(o->file, one ? one->path : two->path,
2255+
show_submodule_summary(o->file, one->path ? one->path : two->path,
22562256
line_prefix,
22572257
one->sha1, two->sha1, two->dirty_submodule,
22582258
meta, del, add, reset);

0 commit comments

Comments
 (0)