diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-06-01 12:59:58 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-06-01 12:59:58 -0700 |
commit | 92ddfaadc226d4b04681523a3a5649b65b06ca5f (patch) | |
tree | 4319d0b2fc9c057768adaf72281b6bce21d1bc8d | |
parent | Merge branch 'ap/checkout-no-progress-for-non-tty' into maint (diff) | |
parent | pretty: avoid buffer overflow in format_person_part (diff) | |
download | tgif-92ddfaadc226d4b04681523a3a5649b65b06ca5f.tar.xz |
Merge branch 'jk/format-person-part-buffer-limit' into maint
By Jeff King
* jk/format-person-part-buffer-limit:
pretty: avoid buffer overflow in format_person_part
-rw-r--r-- | pretty.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -547,8 +547,10 @@ static size_t format_person_part(struct strbuf *sb, char part, mail_end = s.mail_end; if (part == 'N' || part == 'E') { /* mailmap lookup */ - strlcpy(person_name, name_start, name_end - name_start + 1); - strlcpy(person_mail, mail_start, mail_end - mail_start + 1); + snprintf(person_name, sizeof(person_name), "%.*s", + (int)(name_end - name_start), name_start); + snprintf(person_mail, sizeof(person_mail), "%.*s", + (int)(mail_end - mail_start), mail_start); mailmap_name(person_mail, sizeof(person_mail), person_name, sizeof(person_name)); name_start = person_name; name_end = name_start + strlen(person_name); |