Nmap Development mailing list archives
[NSE][PATCH] throw an error in bin.pack for illegal hex characters
From: Sven Klemm <sven () c3d2 de>
Date: Fri, 10 Oct 2008 17:50:28 +0200
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
Index: nse_binlib.cc
===================================================================
--- nse_binlib.cc (revision 10588)
+++ nse_binlib.cc (working copy)
@@ -378,7 +378,12 @@
} else if (isspace(a[ii])) {
/* ignore */
} else {
- /* err ... ignore too*/
+ char * fmt;
+ if (isprint(a[ii]))
+ fmt = "Illegal hex character '%c'";
+ else
+ fmt = "Illegal hex character %p";
+ return luaL_error(L, fmt, (unsigned char) a[ii]);
}
}
if (odd == 1) {
_______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://SecLists.Org
Current thread:
- [NSE][PATCH] throw an error in bin.pack for illegal hex characters Sven Klemm (Oct 10)
- Re: [NSE][PATCH] throw an error in bin.pack for illegal hex characters Patrick Donnelly (Oct 10)
- Re: [NSE][PATCH] throw an error in bin.pack for illegal hex characters Sven Klemm (Oct 10)
- Re: [NSE][PATCH] throw an error in bin.pack for illegal hex characters Patrick Donnelly (Oct 10)
- Re: [NSE][PATCH] throw an error in bin.pack for illegal hex characters David Fifield (Oct 10)
- Re: [NSE][PATCH] throw an error in bin.pack for illegal hex characters Sven Klemm (Oct 12)
- Re: [NSE][PATCH] throw an error in bin.pack for illegal hex characters Patrick Donnelly (Oct 12)
- Re: [NSE][PATCH] throw an error in bin.pack for illegal hex characters David Fifield (Oct 12)
- Re: [NSE][PATCH] throw an error in bin.pack for illegal hex characters Patrick Donnelly (Oct 12)
- Re: [NSE][PATCH] throw an error in bin.pack for illegal hex characters Sven Klemm (Oct 10)
- Re: [NSE][PATCH] throw an error in bin.pack for illegal hex characters Patrick Donnelly (Oct 10)
