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:
@@ -182,13 +182,14 @@ function is_path_valid(resource)
|
|||||||
--remove the beginning slash
|
--remove the beginning slash
|
||||||
resource = string.sub(resource, 2, string.len(resource))
|
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.)
|
--(Windows drive names are not welcome too.)
|
||||||
if resource:match("^([a-zA-Z]):") then
|
if resource:match("^([a-zA-Z]):") then
|
||||||
return false
|
return false
|
||||||
end
|
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
|
if first_char == "." then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user