mirror of
https://github.com/nmap/nmap.git
synced 2026-10-08 06:12:23 +00:00
Make packet.in_cksum work for data with an odd length.
This commit is contained in:
parent
2b8b5e2f6a
commit
9817ee470d
1 changed files with 3 additions and 0 deletions
|
|
@ -82,6 +82,9 @@ function in_cksum(b)
|
|||
x = x:sub(3)
|
||||
sum = sum + u16(c, 0)
|
||||
end
|
||||
if x:len() == 1 then
|
||||
sum = sum + u8(x, 0) * 256
|
||||
end
|
||||
|
||||
sum = bit.rshift(sum, 16) + bit.band(sum, 0xffff)
|
||||
sum = sum + bit.rshift(sum, 16)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue