Bugfix - Opening inexistent file

pull/3/head
Swissky 2017-11-12 13:42:25 +01:00
parent ca3fba1758
commit e280f50e0f
1 changed files with 7 additions and 3 deletions

View File

@ -103,9 +103,13 @@ def check_declaration(content, vuln, path):
# Path is the path of the current scanned file, we can use it to compute the relative include # Path is the path of the current scanned file, we can use it to compute the relative include
for include in includes: for include in includes:
relative_include = os.path.dirname(path)+"/" relative_include = os.path.dirname(path)+"/"
path_include = relative_include + include[1] try:
with open(path_include, 'r') as f: path_include = relative_include + include[1]
content = f.read() + content with open(path_include, 'r') as f:
content = f.read() + content
except Exception as e:
return (False, "","")
# Extract declaration - for ($something as $somethingelse) # Extract declaration - for ($something as $somethingelse)
regex_declaration2 = re.compile("\$(.*?)([\t ]*)as(?!=)([\t ]*)\$"+vuln[1:]) regex_declaration2 = re.compile("\$(.*?)([\t ]*)as(?!=)([\t ]*)\$"+vuln[1:])