summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-04-25 07:41:22 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-04-25 07:41:22 (GMT)
commit0830eac14cf6d0f0392a3a87d96f916e79dc4319 (patch)
tree590b6c791f22339b145d79042127206f4f2bd58c /dir.c
parentaf152bd5b04933239f338044d43e63b549b97ea6 (diff)
parent3a7b45a62360ff0e14f7150ee2d9930c0c258dbd (diff)
downloadgit-0830eac14cf6d0f0392a3a87d96f916e79dc4319.zip
git-0830eac14cf6d0f0392a3a87d96f916e79dc4319.tar.gz
git-0830eac14cf6d0f0392a3a87d96f916e79dc4319.tar.bz2
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 1c488b5..ad30a5a 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;