Unverified Commit b83bc6d4 by Edward Thomson Committed by GitHub

Merge pull request #5510 from phkelley/stash-to-index-crash

Fix uninitialized stack memory and NULL ptr dereference in stash_to_index
parents d62e44cb 56c95cf6
...@@ -173,7 +173,7 @@ static int stash_to_index( ...@@ -173,7 +173,7 @@ static int stash_to_index(
git_index *index, git_index *index,
const char *path) const char *path)
{ {
git_index *repo_index; git_index *repo_index = NULL;
git_index_entry entry = {{0}}; git_index_entry entry = {{0}};
struct stat st; struct stat st;
int error; int error;
...@@ -187,7 +187,7 @@ static int stash_to_index( ...@@ -187,7 +187,7 @@ static int stash_to_index(
return error; return error;
git_index_entry__init_from_stat(&entry, &st, 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; entry.path = path;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment