Re: [PATCH 1/1] get_sha1_hex(): do not read past a NUL character
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 23, 2011, 18:59 UTC
- Message-ID
- <7vaa9vulsw.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <1316785116-21831-1-git-send-email-mhagger@alum.mit.edu>
Michael Haggerty <mhagger@alum.mit.edu> writes:
Show 7 quoted lines
> 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.