From: Junio C Hamano Date: Tue, 07 Aug 2012 15:45:09 GMT Subject: Re: [PATCH/RFC v2 01/16] Modify cache_header to prepare for other index formats Message-ID: <7v8vdqwvsq.fsf@alter.siamese.dyndns.org> In-Reply-To: <20120807124105.GA913@tgummerer> Thomas Gummerer writes: > This part is called even before we know what version of the index > we will read, and before the file is mmaped. The best solution > i think is to drop the check and just call verify_hdr, ... Exactly. And do the length checking inside verify_hdr() or its callee where we know what the minimum length is depending on the version as necessary to avoid over-reading.