From 27af1d09df169170256490e475fdbf93d415b51d Mon Sep 17 00:00:00 2001 From: david Date: Mon, 14 Oct 2013 01:35:44 +0000 Subject: [PATCH] Use 1-indexing for first char of Lua string. sub(0, 1) worked, but it's more clear to do sub(1, 1). --- ncat/scripts/httpd.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ncat/scripts/httpd.lua b/ncat/scripts/httpd.lua index 05383df70..d7bc411a5 100644 --- a/ncat/scripts/httpd.lua +++ b/ncat/scripts/httpd.lua @@ -221,7 +221,7 @@ function is_path_valid(resource) end --if it starts with a dot or a slash or a backslash, forbid any acccess to it. - first_char = resource:sub(0, 1) + first_char = resource:sub(1, 1) if first_char == "." then return false @@ -373,7 +373,7 @@ debug("Got a request for '" .. resource resource = url_decode(resource) --make sure that the resource starts with a slash. -if resource:sub(0, 1) ~= '/' then +if resource:sub(1, 1) ~= '/' then do_400() --could probably use a fancier error here. end