Merge branch 'rm/strchrnul-not-strlen'
[gitweb.git] / pretty.c
index 6e266ddf2749ab1b2388f72e3a1101e98fa656cc..3c43db558aee43b0ea69c23c6611dcc9fae0661f 100644 (file)
--- a/pretty.c
+++ b/pretty.c
@@ -555,14 +555,13 @@ static char *get_header(const struct commit *commit, const char *msg,
        const char *line = msg;
 
        while (line) {
-               const char *eol = strchr(line, '\n'), *next;
+               const char *eol = strchrnul(line, '\n'), *next;
 
                if (line == eol)
                        return NULL;
-               if (!eol) {
+               if (!*eol) {
                        warning("malformed commit (header is missing newline): %s",
                                sha1_to_hex(commit->object.sha1));
-                       eol = line + strlen(line);
                        next = NULL;
                } else
                        next = eol + 1;