From: Stefan Beller <stefanbeller@googlemail.com>
To: gitster@pobox.com, Jens.Lehmann@web.de,
Johannes.Schindelin@gmx.de, git@vger.kernel.org
Cc: Stefan Beller <stefanbeller@googlemail.com>
Subject: [PATCH] diff: fix a possible null pointer dereference
Date: Fri, 9 Aug 2013 00:11:53 +0200 [thread overview]
Message-ID: <1375999913-4912-1-git-send-email-stefanbeller@googlemail.com> (raw)
In-Reply-To: <7v8v0b96xe.fsf@alter.siamese.dyndns.org>
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>
---
diff.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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);
--
1.8.4.rc1.25.gd121ba2
next prev parent reply other threads:[~2013-08-08 22:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-08 18:55 [PATCH] diff: remove another ternary expression always evaluating to true Stefan Beller
2013-08-08 21:01 ` Johannes Schindelin
2013-08-08 21:22 ` Stefan Beller
2013-08-08 21:36 ` Johannes Schindelin
2013-08-08 22:03 ` Junio C Hamano
2013-08-08 22:11 ` Stefan Beller [this message]
2013-08-08 21:36 ` Philip Oakley
2013-08-08 22:17 ` Stefan Beller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1375999913-4912-1-git-send-email-stefanbeller@googlemail.com \
--to=stefanbeller@googlemail.com \
--cc=Jens.Lehmann@web.de \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).