summaryrefslogtreecommitdiff
path: root/archive-tar.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2017-02-14 17:27:45 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-02-14 19:28:53 (GMT)
commitd9e557a320bd4695bccad873e176562489b2d199 (patch)
tree136c4bfc8528f19fd593f6c83d429b03ed5cfb2f /archive-tar.c
parente6a7c75298001996790059e3ae70c627b3204dd9 (diff)
downloadgit-d9e557a320bd4695bccad873e176562489b2d199.zip
git-d9e557a320bd4695bccad873e176562489b2d199.tar.gz
git-d9e557a320bd4695bccad873e176562489b2d199.tar.bz2
show-branch: store resolved head in heap buffer
We resolve HEAD and copy the result to a fixed-size buffer with memcpy, never checking that it actually fits. This bug dates back to 8098a178b (Add git-symbolic-ref, 2005-09-30). Before that we used readlink(), which took a maximum buffer size. We can fix this by using resolve_refdup(), which duplicates the buffer on the heap. That also lets us just check for a NULL pointer to see if we have resolved HEAD, and drop the extra head_p variable. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'archive-tar.c')
0 files changed, 0 insertions, 0 deletions