From: Junio C Hamano Date: Tue, 27 Jan 2009 23:23:46 +0000 (-0800) Subject: Merge branch 'maint-1.6.0' into maint X-Git-Tag: v1.6.1.2~10 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/899d8dc392494e78040ea13db202de894040bda8?hp=-c Merge branch 'maint-1.6.0' into maint * maint-1.6.0: test-path-utils: Fix off by one, found by valgrind get_sha1_basic(): fix invalid memory access, found by valgrind --- 899d8dc392494e78040ea13db202de894040bda8 diff --combined sha1_name.c index 159c2ab84f,c4fdaded01..722fc35a6d --- a/sha1_name.c +++ b/sha1_name.c @@@ -309,7 -309,7 +309,7 @@@ static int get_sha1_basic(const char *s /* basic@{time or number} format to query ref-log */ reflog_len = at = 0; - if (str[len-1] == '}') { + if (len && str[len-1] == '}') { for (at = 0; at < len - 1; at++) { if (str[at] == '@' && str[at+1] == '{') { reflog_len = (len-1) - (at+2); @@@ -351,10 -351,7 +351,10 @@@ else nth = -1; } - if (0 <= nth) + if (100000000 <= nth) { + at_time = nth; + nth = -1; + } else if (0 <= nth) at_time = 0; else { char *tmp = xstrndup(str + at + 2, reflog_len);