]> asedeno.scripts.mit.edu Git - git.git/blobdiff - commit.c
connect: display connection progress
[git.git] / commit.c
index aa7059c1c6dd7650aa0623443372cfa804a0787c..bee066fa3227c876022424bd0e6238c1053e1231 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -638,7 +638,9 @@ static char *get_header(const struct commit *commit, const char *key)
                        next = NULL;
                } else
                        next = eol + 1;
-               if (!strncmp(line, key, key_len) && line[key_len] == ' ') {
+               if (eol - line > key_len &&
+                   !strncmp(line, key, key_len) &&
+                   line[key_len] == ' ') {
                        int len = eol - line - key_len;
                        char *ret = xmalloc(len);
                        memcpy(ret, line + key_len + 1, len - 1);
@@ -1061,6 +1063,7 @@ unsigned long pretty_print_commit(enum cmit_fmt fmt,
                        int sz;
                        char header[512];
                        const char *header_fmt =
+                               "MIME-Version: 1.0\n"
                                "Content-Type: text/plain; charset=%s\n"
                                "Content-Transfer-Encoding: 8bit\n";
                        sz = snprintf(header, sizeof(header), header_fmt,