Handle case were { is on a newline

This commit is contained in:
Alexandre Aubin 2019-03-09 19:22:43 +01:00
parent f6e98894cf
commit 82b715f068

View file

@ -169,7 +169,7 @@ class App():
lines_iter = lines.__iter__() lines_iter = lines.__iter__()
for line in lines_iter: for line in lines_iter:
if line.startswith("location"): if line.startswith("location"):
location_line = line location_line = line.split()
break break
# Look at the next lines for an 'alias' directive # Look at the next lines for an 'alias' directive
if location_line is not None: if location_line is not None:
@ -181,7 +181,7 @@ class App():
if line.startswith("alias"): if line.startswith("alias"):
# We should definitely check for path traversal issue # We should definitely check for path traversal issue
# Does the location target ends with / ? # Does the location target ends with / ?
target = location_line.split()[-2] target = location_line[-2] if location_line[-1] == "{" else location_line[-1]
if not target.endswith("/"): if not target.endswith("/"):
path_traversal_vulnerable = True path_traversal_vulnerable = True
break break