]> git.ipfire.org Git - thirdparty/git.git/commit - setup.c
setup: sanity check file size in read_gitfile_gently
authorErik Elfström <erik.elfstrom@gmail.com>
Mon, 15 Jun 2015 19:39:52 +0000 (21:39 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 15 Jun 2015 20:14:01 +0000 (13:14 -0700)
commit921bdd96afc17ca055af261066eabdf026cb2195
tree4fb673cb9182575f264e4564f9981d862b993108
parenta93bedada88dc15b0143708e1cb87c8fe9b9c705
setup: sanity check file size in read_gitfile_gently

read_gitfile_gently will allocate a buffer to fit the entire file that
should be read. Add a sanity check of the file size before opening to
avoid allocating a potentially huge amount of memory if we come across
a large file that someone happened to name ".git". The limit is set to
a sufficiently unreasonable size that should never be exceeded by a
genuine .git file.

Signed-off-by: Erik Elfström <erik.elfstrom@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
cache.h
setup.c