1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-14 19:59:02 +00:00

Reorder the checks a bit.

This commit is contained in:
d33tah
2013-09-15 20:17:03 +00:00
parent 800acc5ac1
commit 8fa61605ba

View File

@@ -182,13 +182,14 @@ function is_path_valid(resource)
--remove the beginning slash
resource = string.sub(resource, 2, string.len(resource))
--if it starts with a dot or a slash or a backslash, forbid any acccess to it.
first_char = resource:sub(0, 1)
--(Windows drive names are not welcome too.)
if resource:match("^([a-zA-Z]):") then
return false
end
--if it starts with a dot or a slash or a backslash, forbid any acccess to it.
first_char = resource:sub(0, 1)
if first_char == "." then
return false
end