Commit 56c95cf6 by Philip Kelley

Fix uninitialized stack memory and NULL ptr dereference in stash_to_index

Caught by static analysis.
parent d62e44cb
......@@ -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;
......
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