Merge pull request #1908 from DaveLak/fix-issue-1887 · gitpython-developers/GitPython@82bb3bb · GitHub
Skip to content

Commit 82bb3bb

Browse files
authored
Merge pull request #1908 from DaveLak/fix-issue-1887
Fix `IndexError` in `GitConfigParser` When a Quoted Config Value Contains a Trailing New Line
2 parents fa2b2d6 + 1a0ab5b commit 82bb3bb

3 files changed

Lines changed: 11 additions & 7 deletions

File tree

fuzzing/fuzz-targets/fuzz_config.py

Lines changed: 2 additions & 6 deletions

git/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ def _read(self, fp: Union[BufferedReader, IO[bytes]], fpname: str) -> None:
452452
e = None # None, or an exception.
453453

454454
def string_decode(v: str) -> str:
455-
if v[-1] == "\\":
455+
if v and v.endswith("\\"):
456456
v = v[:-1]
457457
# END cut trailing escapes to prevent decode error
458458

test/test_config.py

Lines changed: 8 additions & 0 deletions

0 commit comments

Comments
 (0)