Nmap Development mailing list archives

Re: Completed Lua 5.3 upgrade!


From: Daniel Miller <bonsaiviking () gmail com>
Date: Sat, 18 Jun 2016 10:05:45 -0500

Patrick,

I found a couple bugs in the dns.lua library: a bitwise operation
difference and a variable mixup. Here's the patch:

diff --git a/nselib/dns.lua b/nselib/dns.lua
index ab623f9..093eaa5 100644
--- a/nselib/dns.lua
+++ b/nselib/dns.lua
@@ -1284,19 +1284,19 @@ end
 -- @return Table representing flags.
 local function decodeFlags(flags)
   local tflags = {}
-  if (flags & 0x8000) ~= 0 then flags.QR  = true end
-  if (flags & 0x4000) ~= 0 then flags.OC1 = true end
-  if (flags & 0x2000) ~= 0 then flags.OC2 = true end
-  if (flags & 0x1000) ~= 0 then flags.OC3 = true end
-  if (flags & 0x0800) ~= 0 then flags.OC4 = true end
-  if (flags & 0x0400) ~= 0 then flags.AA  = true end
-  if (flags & 0x0200) ~= 0 then flags.TC  = true end
-  if (flags & 0x0100) ~= 0 then flags.RD  = true end
-  if (flags & 0x0080) ~= 0 then flags.RA  = true end
-  if (flags & 0x0008) ~= 0 then flags.RC1 = true end
-  if (flags & 0x0004) ~= 0 then flags.RC2 = true end
-  if (flags & 0x0002) ~= 0 then flags.RC3 = true end
-  if (flags & 0x0001) ~= 0 then flags.RC4 = true end
+  if (flags & 0x8000) ~= 0 then tflags.QR  = true end
+  if (flags & 0x4000) ~= 0 then tflags.OC1 = true end
+  if (flags & 0x2000) ~= 0 then tflags.OC2 = true end
+  if (flags & 0x1000) ~= 0 then tflags.OC3 = true end
+  if (flags & 0x0800) ~= 0 then tflags.OC4 = true end
+  if (flags & 0x0400) ~= 0 then tflags.AA  = true end
+  if (flags & 0x0200) ~= 0 then tflags.TC  = true end
+  if (flags & 0x0100) ~= 0 then tflags.RD  = true end
+  if (flags & 0x0080) ~= 0 then tflags.RA  = true end
+  if (flags & 0x0008) ~= 0 then tflags.RC1 = true end
+  if (flags & 0x0004) ~= 0 then tflags.RC2 = true end
+  if (flags & 0x0002) ~= 0 then tflags.RC3 = true end
+  if (flags & 0x0001) ~= 0 then tflags.RC4 = true end
   return tflags
 end

@@ -1319,7 +1319,8 @@ function decode(data)
   -- the flags are enough for the current code to determine whether an
update was successful or not
   --
   local flags = encodeFlags(pkt.flags)
-  if (flags & 0xA000) ~= 0 then
+  -- QR, OC2
+  if (flags & 0xF000) == 0xA000 then
     return pkt
   else
     pos, pkt.questions = decodeQuestions(data, cnt.q, pos)


Dan

On Fri, Jun 17, 2016 at 7:43 PM, Patrick Donnelly <batrick () batbytes com>
wrote:

On Wed, Jun 8, 2016 at 9:31 PM, Patrick Donnelly <batrick () batbytes com>
wrote:
Without further ado, here's the branch:

https://github.com/batrick/nmap/tree/nse-lua53

If there are no questions/comments/complaints/objections, I'd like to
merge the branch sometime around next Friday. All feedback is still
welcome!

--
Patrick Donnelly
_______________________________________________
Sent through the dev mailing list
https://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/

_______________________________________________
Sent through the dev mailing list
https://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/

Current thread: