From: Junio C Hamano Date: Fri, 23 Sep 2011 18:59:43 GMT Subject: Re: [PATCH 1/1] get_sha1_hex(): do not read past a NUL character Message-ID: <7vaa9vulsw.fsf@alter.siamese.dyndns.org> In-Reply-To: <1316785116-21831-1-git-send-email-mhagger@alum.mit.edu> Michael Haggerty writes: > Previously, get_sha1_hex() would read one character past the end of a > null-terminated string whose strlen was an even number less than 40. > Although the function correctly returned -1 in these cases, the extra > memory access might have been to uninitialized (or even, conceivably, > unallocated) memory. > > Add a check to avoid reading past the end of a string. Makes sense; thanks.