]> git.ipfire.org Git - thirdparty/git.git/blobdiff - attr.c
attr: ignore attribute lines exceeding 2048 bytes
[thirdparty/git.git] / attr.c
diff --git a/attr.c b/attr.c
index 41657479fffbe2a7edd45614093ddc19d4878034..38ecd2fff30d33a86ec11f16f454a0a504a15fa2 100644 (file)
--- a/attr.c
+++ b/attr.c
@@ -344,6 +344,11 @@ static struct match_attr *parse_attr_line(const char *line, const char *src,
                return NULL;
        name = cp;
 
+       if (strlen(line) >= ATTR_MAX_LINE_LENGTH) {
+               warning(_("ignoring overly long attributes line %d"), lineno);
+               return NULL;
+       }
+
        if (*cp == '"' && !unquote_c_style(&pattern, name, &states)) {
                name = pattern.buf;
                namelen = pattern.len;