diff --git a/sha1_name.c b/sha1_name.c
index 491d2e7ebf19d5c582adbc5ece28d931b09b8a6d..b0b2167578a7baebeba676af0b33161fb688bae0 100644 (file)
--- a/sha1_name.c
+++ b/sha1_name.c
}
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)