Skip to content

Commit 4a9017d

Browse files
committed
svnwc: fix regular expression vulnerable to DoS in blame functionality
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.
1 parent 2da2cae commit 4a9017d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

py/_path/svnwc.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ def makecmdoptions(self):
396396
def __str__(self):
397397
return "<SvnAuth username=%s ...>" %(self.username,)
398398

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

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

0 commit comments

Comments
 (0)