summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Beller <stefanbeller@googlemail.com>2013-08-08 22:11:53 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-08-09 19:07:36 (GMT)
commit3b0c18af5c545c93bf33b53d467b887e9733c0c6 (patch)
tree17133099add0ded9a0efe02903a0778cdb0ee97b
parentc189c4f2c42083b329605fb7b0583b29b73da086 (diff)
downloadgit-3b0c18af5c545c93bf33b53d467b887e9733c0c6.zip
git-3b0c18af5c545c93bf33b53d467b887e9733c0c6.tar.gz
git-3b0c18af5c545c93bf33b53d467b887e9733c0c6.tar.bz2
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 <stefanbeller@googlemail.com> Acked-By: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--diff.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/diff.c b/diff.c
index 80f8439..061694b 100644
--- a/diff.c
+++ b/diff.c
@@ -2252,7 +2252,7 @@ static void builtin_diff(const char *name_a,
(!two->mode || S_ISGITLINK(two->mode))) {
const char *del = diff_get_color_opt(o, DIFF_FILE_OLD);
const char *add = diff_get_color_opt(o, DIFF_FILE_NEW);
- show_submodule_summary(o->file, one ? one->path : two->path,
+ show_submodule_summary(o->file, one->path ? one->path : two->path,
line_prefix,
one->sha1, two->sha1, two->dirty_submodule,
meta, del, add, reset);