From 03a42edfe5b2b8ac7c167ef71cfc45de61f23cf1 Mon Sep 17 00:00:00 2001 From: david Date: Sun, 27 Mar 2011 05:07:26 +0000 Subject: [PATCH] Parse more than one type bitmap block in an NSEC record if present. --- nselib/dns.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/nselib/dns.lua b/nselib/dns.lua index 4f74fd870..e55342464 100644 --- a/nselib/dns.lua +++ b/nselib/dns.lua @@ -986,14 +986,16 @@ end -- @param pos Position in packet after RR. decoder[types.NSEC] = function (entry, data, pos) local np = pos - #entry.data - local block_num, type_bitmap entry.NSEC = {} entry.NSEC.dname = entry.dname np, entry.NSEC.next_dname = decStr(data, np) - np, block_num, type_bitmap = bin.unpack(">Cp", data, np) - entry.NSEC.types = {} - for i in bit_iter(type_bitmap) do - entry.NSEC.types[(block_num - 1) * 256 + i] = true + while np < pos do + local block_num, type_bitmap + np, block_num, type_bitmap = bin.unpack(">Cp", data, np) + entry.NSEC.types = {} + for i in bit_iter(type_bitmap) do + entry.NSEC.types[(block_num - 1) * 256 + i] = true + end end end