Nmap Development mailing list archives

Re: [NSE][PATCH] throw an error in bin.pack for illegal hex characters


From: "Patrick Donnelly" <batrick.donnelly () gmail com>
Date: Fri, 10 Oct 2008 10:58:36 -0600

On Fri, Oct 10, 2008 at 9:50 AM, Sven Klemm <sven () c3d2 de> wrote:
Hi everyone,

currently bin.pack('H','ABCDEFG') does not throw an error for invalid
hex characters when packing hex data but ignores invalid input. The
attached patch changes this.
luaL_error only supports a very limited set of format specifiers
that's why I'm using %p for unprintable characters.

SCRIPT ENGINE: ./scripts/debug.nse:30: Illegal hex character 'G'

SCRIPT ENGINE: ./scripts/debug.nse:30: Illegal hex character 0xfa

Cheers,
Sven

It's probably best that this library's design decisions not be changed
at this point. lpack is a fairly common library in the Lua community
and people would not expect this to error. From just a quick search of
the code, there appears to be no intentionally thrown errors by the
library. It is also highly probable that large pieces of this library
be integrated into a struct library in Lua 5.2, in which case we will
most likely remove this library. In the interest of consistency, we
should not change something unless it is truly warranted.

Cheers,

-- 
-Patrick Donnelly

"One of the lessons of history is that nothing is often a good thing
to do and always a clever thing to say."

-Will Durant

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org


Current thread: