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)
5151
5252 for (;;) {
5353 int c = get_next_char ();
54- if (len >= sizeof (value ))
54+ if (len >= sizeof (value ) - 1 )
5555 return NULL ;
5656 if (c == '\n' ) {
5757 if (quote )
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ setup() {
1010
1111check () {
1212 echo " $2 " > expected
13- git config --get " $1 " > actual
13+ git config --get " $1 " > actual 2>&1
1414 test_cmp actual expected
1515}
1616
@@ -40,4 +40,11 @@ test_expect_success 'make sure git config escapes section names properly' '
4040 check "$SECTION" bar
4141'
4242
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+
4350test_done
You can’t perform that action at this time.
0 commit comments