summaryrefslogtreecommitdiff
path: root/src/commit.c
diff options
context:
space:
mode:
authorPaul Holden <paulholden2@gmail.com>2013-12-08 02:03:05 -0800
committerPaul Holden <paulholden2@gmail.com>2013-12-08 10:21:13 -0800
commitbe0a1a79588c24b0cf032809c83d0b9cd167e0a9 (patch)
tree9a70e62cc66f6ce2607eb222f55b243085e43c51 /src/commit.c
parentc4fcae5f7cacf9478d1d92c6586615e5afcc3ac8 (diff)
downloadlibgit2-be0a1a79588c24b0cf032809c83d0b9cd167e0a9.tar.gz
commit: Fix potential segfault in git_commit_message
Dereferencing commit pointer before asserting
Diffstat (limited to 'src/commit.c')
-rw-r--r--src/commit.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/commit.c b/src/commit.c
index bbb76f350..4ddfafb41 100644
--- a/src/commit.c
+++ b/src/commit.c
@@ -276,10 +276,12 @@ GIT_COMMIT_GETTER(const git_oid *, tree_id, &commit->tree_id);
const char *git_commit_message(const git_commit *commit)
{
- const char *message = commit->raw_message;
+ const char *message;
assert(commit);
+ message = commit->raw_message;
+
/* trim leading newlines from raw message */
while (*message && *message == '\n')
++message;