File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ static char *parse_value(void)
51
51
52
52
for (;;) {
53
53
int c = get_next_char ();
54
- if (len >= sizeof (value ))
54
+ if (len >= sizeof (value ) - 1 )
55
55
return NULL ;
56
56
if (c == '\n' ) {
57
57
if (quote )
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ setup() {
10
10
11
11
check () {
12
12
echo " $2 " > expected
13
- git config --get " $1 " > actual
13
+ git config --get " $1 " > actual 2>&1
14
14
test_cmp actual expected
15
15
}
16
16
@@ -40,4 +40,11 @@ test_expect_success 'make sure git config escapes section names properly' '
40
40
check "$SECTION" bar
41
41
'
42
42
43
+ LONG_VALUE=$( printf " x%01021dx a" 7)
44
+ test_expect_success ' do not crash on special long config line' '
45
+ setup &&
46
+ git config section.key "$LONG_VALUE" &&
47
+ check section.key "fatal: bad config file line 2 in .git/config"
48
+ '
49
+
43
50
test_done
You can’t perform that action at this time.
0 commit comments