From 1b370e16a4548baf645df98e4452b79535c824e7 Mon Sep 17 00:00:00 2001 From: patrik Date: Tue, 3 Jan 2012 14:20:13 +0000 Subject: [PATCH] o [NSE] Fixed bug in match.numbytes that would return one byte less than what was requested. Updated redis library to take the fix into account. [Patrik] --- CHANGELOG | 3 +++ nselib/match.lua | 2 +- nselib/redis.lua | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 37c5fd836..ae32fbd14 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,8 @@ # Nmap Changelog ($Id$); -*-text-*- +o [NSE] Fixed bug in match.numbytes that would return one byte less than what + was requested. Updated redis library to take the fix into account. [Patrik] + o Added probe and matchline for Couchbase Membase NoSQL database [Patrik] o Added the new --script-args-file option which allows you to specify diff --git a/nselib/match.lua b/nselib/match.lua index 0224724cd..55d207c6b 100644 --- a/nselib/match.lua +++ b/nselib/match.lua @@ -45,7 +45,7 @@ end -- @usage sock:receive_buf(match.numbytes(80)) -- @see nmap.receive_buf numbytes = function(num) - local n = num + local n = num + 1 return function(buf) if(#buf >=n) then return n, n diff --git a/nselib/redis.lua b/nselib/redis.lua index 233ec80be..8f08100f7 100644 --- a/nselib/redis.lua +++ b/nselib/redis.lua @@ -76,7 +76,7 @@ Response = { local len = tonumber(data:match("^%$(%d*)")) -- we should only have a single line, so we can just peel of the length - status, data = self.socket:receive_buf(match.numbytes(len)) + status, data = self.socket:receive_buf(match.numbytes(len-1)) if( not(status) ) then return false, "Failed to receive data from server" end