Skip to content

Commit 85e1d5a

Browse files
author
Aaron Meihm
committed
iputils: remove unnecessary code in ip2bin
1 parent 2cd0996 commit 85e1d5a

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

moz_security/modules/iputils.lua

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,19 +102,13 @@ local function ip2bin(ip)
102102
end
103103

104104
-- Return the binary representation of an IP and a table of binary octets
105-
local bin_octets = {}
106105
local bin_ip = 0
107106

108107
for i,octet in ipairs(octets) do
109-
local bin_octet = tonumber(octet)
110-
if not bin_octet or bin_octet < 0 or bin_octet > 255 then
111-
return nil
112-
end
113-
bin_octets[i] = bin_octet
114-
bin_ip = bit.bor(bit.lshift(bin_octet, 8*(4-i) ), bin_ip)
108+
bin_ip = bit.bor(bit.lshift(octet, 8*(4-i) ), bin_ip)
115109
end
116110

117-
return unsign(bin_ip), bin_octets
111+
return unsign(bin_ip), octets
118112
end
119113

120114

0 commit comments

Comments
 (0)