dir.c: use st_add3() for allocation size
commit6836d2fe06cea750ba7364895f8f37c32a34408c
authorJunio C Hamano <gitster@pobox.com>
Fri, 20 Dec 2019 17:55:53 +0000 (20 09:55 -0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 20 Dec 2019 17:55:53 +0000 (20 09:55 -0800)
tree8258b87863ec384ad4a7a955e5ff375fa4684c71
parentc847dfafeee8b0fe3e053ac307de88e04d1ad072
dir.c: use st_add3() for allocation size

When preparing a manufactured dirent instance, we add a length of
path to the size of struct to decide how many bytes to allocate.
Make sure this addition does not wrap-around to cause us
underallocate.

Suggested-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
dir.c