summaryrefslogtreecommitdiff
path: root/ident.c
diff options
context:
space:
mode:
Diffstat (limited to 'ident.c')
-rw-r--r--ident.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ident.c b/ident.c
index caf41fb2a9..281e830573 100644
--- a/ident.c
+++ b/ident.c
@@ -59,7 +59,7 @@ static struct passwd *xgetpwuid_self(int *is_bogus)
static void copy_gecos(const struct passwd *w, struct strbuf *name)
{
- char *src;
+ const char *src;
/* Traditionally GECOS field had office phone numbers etc, separated
* with commas. Also & stands for capitalized form of the login name.
@@ -412,6 +412,10 @@ void apply_mailmap_to_header(struct strbuf *buf, const char **header,
found_header = 1;
buf_offset += endp - line;
buf_offset += rewrite_ident_line(person, endp - person, buf, mailmap);
+ /* Recompute endp after potential buffer reallocation */
+ endp = buf->buf + buf_offset;
+ if (*endp == '\n')
+ buf_offset++;
break;
}