mirror of
https://github.com/git/git.git
synced 2024-11-27 12:03:55 +08:00
Merge branch 'js/untracked-cache-allocfix'
An underallocation in the code to read the untracked cache extension has been corrected. * js/untracked-cache-allocfix: untracked cache: fix off-by-one
This commit is contained in:
commit
0830eac14c
2
dir.c
2
dir.c
@ -2756,7 +2756,7 @@ static int read_one_dir(struct untracked_cache_dir **untracked_,
|
||||
next = data + len + 1;
|
||||
if (next > rd->end)
|
||||
return -1;
|
||||
*untracked_ = untracked = xmalloc(st_add(sizeof(*untracked), len));
|
||||
*untracked_ = untracked = xmalloc(st_add3(sizeof(*untracked), len, 1));
|
||||
memcpy(untracked, &ud, sizeof(ud));
|
||||
memcpy(untracked->name, data, len + 1);
|
||||
data = next;
|
||||
|
Loading…
Reference in New Issue
Block a user