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:
2
dir.c
2
dir.c
@ -2756,7 +2756,7 @@ static int read_one_dir(struct untracked_cache_dir **untracked_,
|
|||||||
next = data + len + 1;
|
next = data + len + 1;
|
||||||
if (next > rd->end)
|
if (next > rd->end)
|
||||||
return -1;
|
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, &ud, sizeof(ud));
|
||||||
memcpy(untracked->name, data, len + 1);
|
memcpy(untracked->name, data, len + 1);
|
||||||
data = next;
|
data = next;
|
||||||
|
Reference in New Issue
Block a user