diff options
author | Steffen Prohaska <prohaska@zib.de> | 2007-10-18 22:02:35 +0200 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2007-10-18 21:11:27 -0400 |
commit | d7b0a09316fe8dcb62ad247dbbb45c3c777667ad (patch) | |
tree | a502781dd4cb2d46d3e4937263e61866ada2f66d /attr.c | |
parent | 415e7b877c54440bf92137a7021416efdf0a29b5 (diff) | |
download | git-d7b0a09316fe8dcb62ad247dbbb45c3c777667ad.tar.gz |
attr: fix segfault in gitattributes parsing code
git may segfault if gitattributes contains an invalid
entry. A test is added to t0020 that triggers the segfault.
The parsing code is fixed to avoid the crash.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'attr.c')
-rw-r--r-- | attr.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -214,8 +214,11 @@ static struct match_attr *parse_attr_line(const char *line, const char *src, num_attr = 0; cp = name + namelen; cp = cp + strspn(cp, blank); - while (*cp) + while (*cp) { cp = parse_attr(src, lineno, cp, &num_attr, res); + if (!cp) + return NULL; + } if (pass) break; res = xcalloc(1, |