projects
/
zefram
/
minetest
/
minetest_engine.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c8a9940
)
Make print() NUL-safe
author
ShadowNinja
<shadowninja@minetest.net>
Thu, 15 May 2014 23:09:47 +0000
(19:09 -0400)
committer
ShadowNinja
<shadowninja@minetest.net>
Thu, 15 May 2014 23:09:47 +0000
(19:09 -0400)
src/script/lua_api/l_util.cpp
patch
|
blob
|
history
diff --git
a/src/script/lua_api/l_util.cpp
b/src/script/lua_api/l_util.cpp
index b30bab292ae7382fd7e5212dd85cff7a29efc31e..57db632c9c9fe6526dae0e2e728b21b6985009cf 100644
(file)
--- a/
src/script/lua_api/l_util.cpp
+++ b/
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 << s
td::string(s, len)
;
lua_pop(L, 1);
}
dstream << std::endl;