summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2019-04-25 16:41:22 +0900
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-04-25 16:41:22 +0900
commit0830eac14cf6d0f0392a3a87d96f916e79dc4319 (patch)
tree590b6c791f22339b145d79042127206f4f2bd58c /dir.c
parentMerge branch 'js/t3301-unbreak-notes-test' (diff)
parentuntracked cache: fix off-by-one (diff)
downloadtgif-0830eac14cf6d0f0392a3a87d96f916e79dc4319.tar.xz
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
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/dir.c b/dir.c
index 1c488b5200..ad30a5a46d 100644
--- a/dir.c
+++ b/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;