mirror of
https://github.com/nmap/nmap.git
synced 2026-10-20 19:01:56 +00:00
Avoid edge case where cipher chunk size could be less than 1. See #945
This commit is contained in:
parent
83d46cd9fb
commit
75a873840c
1 changed files with 2 additions and 1 deletions
|
|
@ -415,6 +415,7 @@ end
|
|||
|
||||
local function in_chunks(t, size)
|
||||
size = math.floor(size)
|
||||
if size < 1 then size = 1 end
|
||||
local ret = {}
|
||||
for i = 1, #t, size do
|
||||
local chunk = {}
|
||||
|
|
@ -787,7 +788,7 @@ local function get_chunk_size(host, protocol)
|
|||
local cipher_len_remaining = 255 - #tls.client_hello(len_t)
|
||||
-- if we're over 255 anyway, just go for it.
|
||||
-- Each cipher adds 2 bytes
|
||||
local max_chunks = cipher_len_remaining > 0 and cipher_len_remaining / 2 or CHUNK_SIZE
|
||||
local max_chunks = cipher_len_remaining > 1 and cipher_len_remaining // 2 or CHUNK_SIZE
|
||||
-- otherwise, use the min
|
||||
return max_chunks < CHUNK_SIZE and max_chunks or CHUNK_SIZE
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue