Merge branch 'jc/oneline'
authorJunio C Hamano <gitster@pobox.com>
Sat, 23 Jun 2007 06:33:08 +0000 (23:33 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sat, 23 Jun 2007 06:33:08 +0000 (23:33 -0700)
* jc/oneline:
pp_header(): work around possible memory corruption

1  2 
commit.c
diff --combined commit.c
index f778bf4d6c4742406d051b3bceae5450f29720ac,dbb28b593f3b3b723a619882f1a0b11f124c1807..03436b1b077f3f83cebceb697f97c3ba5b26265c
+++ b/commit.c
@@@ -27,7 -27,7 +27,7 @@@ struct sort_nod
  
  const char *commit_type = "commit";
  
 -struct cmt_fmt_map {
 +static struct cmt_fmt_map {
        const char *n;
        size_t cmp_len;
        enum cmit_fmt v;
@@@ -997,7 -997,7 +997,7 @@@ static void pp_header(enum cmit_fmt fmt
                        len = linelen;
                        if (fmt == CMIT_FMT_EMAIL)
                                len = bound_rfc2047(linelen, encoding);
-                       ALLOC_GROW(*buf_p, *ofs_p + len, *space_p);
+                       ALLOC_GROW(*buf_p, *ofs_p + len + 80, *space_p);
                        dst = *buf_p + *ofs_p;
                        *ofs_p += add_user_info("Author", fmt, dst,
                                                line + 7, dmode, encoding);
                        len = linelen;
                        if (fmt == CMIT_FMT_EMAIL)
                                len = bound_rfc2047(linelen, encoding);
-                       ALLOC_GROW(*buf_p, *ofs_p + len, *space_p);
+                       ALLOC_GROW(*buf_p, *ofs_p + len + 80, *space_p);
                        dst = *buf_p + *ofs_p;
                        *ofs_p += add_user_info("Commit", fmt, dst,
                                                line + 10, dmode, encoding);