aboutsummaryrefslogtreecommitdiff
path: root/fast-import.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2016-02-22 17:44:42 -0500
committerJunio C Hamano <gitster@pobox.com>2016-02-22 14:51:09 -0800
commite0b837351084c3cb52c5acaf8a505835e631744a (patch)
tree2e1fa5ee6e55031c476e081f25a466f59245a68d /fast-import.c
parent20574f551bcc5fcf0f0e20236af174754fa11363 (diff)
downloadgit-e0b837351084c3cb52c5acaf8a505835e631744a.tar.gz
git-e0b837351084c3cb52c5acaf8a505835e631744a.tar.xz
write_untracked_extension: use FLEX_ALLOC helper
We perform unchecked additions when computing the size of a "struct ondisk_untracked_cache". This is unlikely to have an integer overflow in practice, but we'd like to avoid this dangerous pattern to make further audits easier. Note that there's one subtlety here, though. We protect ourselves against a NULL exclude_per_dir entry in our source, and avoid calling strlen() on it, keeping "len" at 0. But later, we unconditionally memcpy "len + 1" bytes to get the trailing NUL byte. If we did have a NULL exclude_per_dir, we would read from bogus memory. As it turns out, though, we always create this field pointing to a string literal, so there's no bug. We can just get rid of the pointless extra conditional. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'fast-import.c')
0 files changed, 0 insertions, 0 deletions