X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=sha1_name.c;h=b0b2167578a7baebeba676af0b33161fb688bae0;hb=f9d800e2074a60a009e7c670e396a379d8c46cc5;hp=491d2e7ebf19d5c582adbc5ece28d931b09b8a6d;hpb=50c2b54b23e0d7df40bd8739c1c96df42c47f280;p=git.git diff --git a/sha1_name.c b/sha1_name.c index 491d2e7eb..b0b216757 100644 --- a/sha1_name.c +++ b/sha1_name.c @@ -351,8 +351,11 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1) } if (0 <= nth) at_time = 0; - else - at_time = approxidate(str + at + 2); + else { + char *tmp = xstrndup(str + at + 2, reflog_len); + at_time = approxidate(tmp); + free(tmp); + } if (read_ref_at(real_ref, at_time, nth, sha1, NULL, &co_time, &co_tz, &co_cnt)) { if (at_time)