Skip to content

Commit

Permalink
Merge pull request #2182 from dscho/untracked-cache-off-by-one
Browse files Browse the repository at this point in the history
Backport "untracked cache: fix off-by-one"
  • Loading branch information
dscho committed May 7, 2019
2 parents 1059065 + 7d8caf9 commit c63a3d5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -2803,7 +2803,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;
Expand Down

0 comments on commit c63a3d5

Please sign in to comment.