worktree: use xsize_t to access file size
authorJeff King <peff@peff.net>
Wed, 27 Sep 2017 06:02:21 +0000 (02:02 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 27 Sep 2017 06:45:57 +0000 (15:45 +0900)
To read the "gitdir" file into memory, we stat the file and
allocate a buffer. But we store the size in an "int", which
may be truncated. We should use a size_t and xsize_t(),
which will detect truncation.

An overflow is unlikely for a "gitdir" file, but it's a good
practice to model.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
No differences found