Change the pattern used to decide which NSE output characters to escape. It was

"[^%w%s%p]"; it's now "[^\t\r\n\032-\126]". The old pattern missed the form
feed character, ASCII 12, which is illegal in XML.
This commit is contained in:
david 2009-02-10 05:57:51 +00:00
parent 2d018963ca
commit 40878cecf9

View file

@ -521,7 +521,11 @@ int process_mainloop(lua_State *L) {
SCRIPT_ENGINE_TRY(process_getScriptId(thread, &sr));
lua_getfield(thread, 2, "gsub");
lua_pushvalue(thread, 2); // output FIXME
lua_pushliteral(thread, "[^%w%s%p]");
/* Escape any character outside the range 32-126 except for
tab, carriage return, and line feed. This makes the
string safe for screen display as well as XML (see
section 2.2 of the XML spec). */
lua_pushliteral(thread, "[^\t\r\n\040-\176]");
lua_pushcclosure(thread, escape_char, 0);
lua_call(thread, 3, 1);
sr.set_output(lua_tostring(thread, -1));