mirror of
https://github.com/nmap/nmap.git
synced 2025-12-07 13:11:28 +00:00
Update ncat scripts: remove bit32 usage, declare locals
This commit is contained in:
@@ -106,9 +106,9 @@ function get_next_char_len(p)
|
|||||||
|
|
||||||
--2-byte, 11-bit sequence?
|
--2-byte, 11-bit sequence?
|
||||||
if c0 < t3 then
|
if c0 < t3 then
|
||||||
local l1 = bit32.lshift(bit32.band(c0,mask2),6)
|
local l1 = (c0 & mask2) << 6
|
||||||
local l2 = bit32.band(c1,maskx)
|
local l2 = c1 & maskx
|
||||||
local r = bit32.bor(l1, l2)
|
local r = l1 | l2
|
||||||
if r <= char1_max then
|
if r <= char1_max then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
@@ -126,10 +126,10 @@ function get_next_char_len(p)
|
|||||||
|
|
||||||
--3-byte, 16-bit sequence?
|
--3-byte, 16-bit sequence?
|
||||||
if c0 < t4 then
|
if c0 < t4 then
|
||||||
local l1 = bit32.lshift(bit32.band(c0, mask3), 12)
|
local l1 = (c0 & mask3) << 12
|
||||||
local l2 = bit32.lshift(bit32.band(c1, maskx), 6)
|
local l2 = (c1 & maskx) << 6
|
||||||
local l3 = bit32.band(c2, maskx)
|
local l3 = c2 & maskx
|
||||||
local r = bit32.bor(l1, l2, l3)
|
local r = l1 | l2 | l3
|
||||||
if r <= char2_max then
|
if r <= char2_max then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
@@ -150,11 +150,11 @@ function get_next_char_len(p)
|
|||||||
|
|
||||||
--4-byte, 21-bit sequence?
|
--4-byte, 21-bit sequence?
|
||||||
if c0 < t5 then
|
if c0 < t5 then
|
||||||
local l1 = bit32.lshift(bit32.band(c0, mask4),18)
|
local l1 = (c0 & mask4) << 18
|
||||||
local l2 = bit32.lshift(bit32.band(c1, maskx), 12)
|
local l2 = (c1 & maskx) << 12
|
||||||
local l3 = bit32.lshift(bit32.band(c2, maskx), 6)
|
local l3 = (c2 & maskx) << 6
|
||||||
local l4 = bit32.band(c3, maskx)
|
local l4 = c3 & maskx
|
||||||
local r = bit32.bor(l1,l2,l3,l4)
|
local r = l1 | l2 | l3 | l4
|
||||||
if r <= char3_max or max_char < r then
|
if r <= char3_max or max_char < r then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
@@ -221,7 +221,7 @@ function is_path_valid(resource)
|
|||||||
end
|
end
|
||||||
|
|
||||||
--if it starts with a dot or a slash or a backslash, forbid any acccess to it.
|
--if it starts with a dot or a slash or a backslash, forbid any acccess to it.
|
||||||
first_char = resource:sub(1, 1)
|
local first_char = resource:sub(1, 1)
|
||||||
|
|
||||||
if first_char == "." then
|
if first_char == "." then
|
||||||
return false
|
return false
|
||||||
@@ -288,7 +288,7 @@ function make_response(params)
|
|||||||
--run the function and print its contents, until we hit nil.
|
--run the function and print its contents, until we hit nil.
|
||||||
local f = params["data"]
|
local f = params["data"]
|
||||||
while true do
|
while true do
|
||||||
ret = f()
|
local ret = f()
|
||||||
if ret == nil then
|
if ret == nil then
|
||||||
debug("Buffered output finished.")
|
debug("Buffered output finished.")
|
||||||
break
|
break
|
||||||
|
|||||||
Reference in New Issue
Block a user