diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2020-05-11 09:18:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-11 09:18:36 +0100 |
commit | b83bc6d4739d10ac3db6513931cedfe8e682f487 (patch) | |
tree | 29c80fc5da9f1de333e361c9e2f5ee58210cf536 | |
parent | d62e44cb8218840a0291fb5fbb7c5106e1e35a12 (diff) | |
parent | 56c95cf6fb4c6af6ae4ec43460dad09159c4700d (diff) | |
download | libgit2-b83bc6d4739d10ac3db6513931cedfe8e682f487.tar.gz |
Merge pull request #5510 from phkelley/stash-to-index-crash
Fix uninitialized stack memory and NULL ptr dereference in stash_to_index
-rw-r--r-- | src/stash.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/stash.c b/src/stash.c index 4a13d0530..790f56fdd 100644 --- a/src/stash.c +++ b/src/stash.c @@ -173,7 +173,7 @@ static int stash_to_index( git_index *index, const char *path) { - git_index *repo_index; + git_index *repo_index = NULL; git_index_entry entry = {{0}}; struct stat st; int error; @@ -187,7 +187,7 @@ static int stash_to_index( return error; git_index_entry__init_from_stat(&entry, &st, - (repo_index != NULL || !repo_index->distrust_filemode)); + (repo_index == NULL || !repo_index->distrust_filemode)); entry.path = path; |