Skip to content
Permalink
Browse files

Make print() NUL-safe

  • Loading branch information...
ShadowNinja committed May 15, 2014
1 parent c8a9940 commit 34d872628d5099ae520dd92433e211f561aaf611
Showing with 4 additions and 3 deletions.
  1. +4 −3 src/script/lua_api/l_util.cpp
@@ -47,11 +47,12 @@ int ModApiUtil::l_debug(lua_State *L)
lua_pushvalue(L, -1); /* function to be called */
lua_pushvalue(L, i); /* value to print */
lua_call(L, 1, 1);
const char *s = lua_tostring(L, -1);
if (i>1)
size_t len;
const char *s = lua_tolstring(L, -1, &len);
if (i > 1)
dstream << "\t";
if (s)
dstream << s;
dstream << std::string(s, len);
lua_pop(L, 1);
}
dstream << std::endl;

0 comments on commit 34d8726

Please sign in to comment.
You can’t perform that action at this time.