Nmap Development mailing list archives
[NSE patch] base64.enc properly encode last character
From: Sven Klemm <sven () c3d2 de>
Date: Tue, 05 Aug 2008 15:03:02 +0200
Hi,the base64 nse library does not properly encode the last character of a string when the string length is not a multiple of 6 bit.
I've attached a patch for the issue. Cheers, Sven -- Sven Klemm http://cthulhu.c3d2.de/~sven/
Index: nselib/base64.lua =================================================================== --- nselib/base64.lua (revision 9342) +++ nselib/base64.lua (working copy) @@ -142,12 +142,10 @@ end end if #nbyte == 2 then - append(b64dataBuf, b64enc6bit(nbyte)) - -- relying on pack's 0-autopadding + append(b64dataBuf, b64enc6bit(nbyte..'0000')) append(b64dataBuf, "==") elseif #nbyte == 4 then - append(b64dataBuf, b64enc6bit(nbyte)) - -- relying on pack's 0-autopadding + append(b64dataBuf, b64enc6bit(nbyte..'00')) append(b64dataBuf, '=') end return concat(b64dataBuf)
_______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://SecLists.Org
Current thread:
- [NSE patch] base64.enc properly encode last character Sven Klemm (Aug 05)
- Re: [NSE patch] base64.enc properly encode last character Philip Pickering (Aug 05)