Skip to content

Commit

Permalink
svnwc: fix regular expression vulnerable to DoS in blame functionality
Browse files Browse the repository at this point in the history
The subpattern `\d+\s*\S+` is ambiguous which makes the pattern subject
to catastrophic backtracing given a string like `"1" * 5000`.

SVN blame output seems to always have at least one space between the
revision number and the user name, so the ambiguity can be fixed by
changing the `*` to `+`.

Fixes #256.
  • Loading branch information
bluetech committed Sep 4, 2020
1 parent 2da2cae commit 4a9017d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion py/_path/svnwc.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ def makecmdoptions(self):
def __str__(self):
return "<SvnAuth username=%s ...>" %(self.username,)

rex_blame = re.compile(r'\s*(\d+)\s*(\S+) (.*)')
rex_blame = re.compile(r'\s*(\d+)\s+(\S+) (.*)')

class SvnWCCommandPath(common.PathBase):
""" path implementation offering access/modification to svn working copies.
Expand Down

0 comments on commit 4a9017d

Please sign in to comment.