--- OLD/builtin-blame.c Thu Jan 1 00:00:00 1970 +++ NEW/builtin-blame.c Thu Jan 1 00:00:00 1970 @@ -1545,10 +1545,12 @@ static const char *format_time(unsigned long time, const char *tz_str, int show_raw_time) { - static char time_buf[128]; + static char *time_buf = 0; + static int tba = 0; const char *time_str; int time_len; int tz; + int l; if (show_raw_time) { sprintf(time_buf, "%lu %s", time, tz_str); @@ -1557,8 +1559,15 @@ tz = atoi(tz_str); time_str = show_date(time, tz, blame_date_mode); time_len = strlen(time_str); + l = ((time_len > blame_date_width) ? time_len : blame_date_width) + 1; + if (l > tba) { + free(time_buf); + tba = l; + time_buf = malloc(tba); + } memcpy(time_buf, time_str, time_len); - memset(time_buf + time_len, ' ', blame_date_width - time_len); + if (time_len < blame_date_width) memset(time_buf + time_len, ' ', blame_date_width - time_len); + time_buf[l-1] = '\0'; } return time_buf; }