Skip to content

Commit 3961c51

Browse files
committed
Merge branch 'cc/split-index-config'
The split-index code configuration code used an unsafe git_path() function without copying its result out. * cc/split-index-config: read-cache: avoid using git_path() in freshen_shared_index()
2 parents b80f629 + ccef2bb commit 3961c51

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

read-cache.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1824,9 +1824,10 @@ int do_read_index(struct index_state *istate, const char *path, int must_exist)
18241824
*/
18251825
static void freshen_shared_index(char *base_sha1_hex, int warn)
18261826
{
1827-
const char *shared_index = git_path("sharedindex.%s", base_sha1_hex);
1827+
char *shared_index = git_pathdup("sharedindex.%s", base_sha1_hex);
18281828
if (!check_and_freshen_file(shared_index, 1) && warn)
18291829
warning("could not freshen shared index '%s'", shared_index);
1830+
free(shared_index);
18301831
}
18311832

18321833
int read_index_from(struct index_state *istate, const char *path)

0 commit comments

Comments
 (0)