aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-12-12 14:31:31 +1100
committerdaurnimator <quae@daurnimator.com>2017-12-12 14:31:39 +1100
commit8dfdad3ee84a73ec7da2312e8c8d893dd8968d17 (patch)
tree29566aa7db102487baa0381a411db8e1161cfce5
parent3355a611f2c30b338e55cc2407b02cc28fe437c5 (diff)
downloadfengari-8dfdad3ee84a73ec7da2312e8c8d893dd8968d17.tar.gz
fengari-8dfdad3ee84a73ec7da2312e8c8d893dd8968d17.tar.bz2
fengari-8dfdad3ee84a73ec7da2312e8c8d893dd8968d17.zip
src/lobject.js: Have luaO_pushvfstring respect null as terminator for %s
-rw-r--r--src/lobject.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lobject.js b/src/lobject.js
index e69a9ef..91078ed 100644
--- a/src/lobject.js
+++ b/src/lobject.js
@@ -526,6 +526,12 @@ const luaO_pushvfstring = function(L, fmt, argp) {
case char['s']: {
let s = argp[a++];
if (s === null) s = defs.to_luastring("(null)", true);
+ else {
+ /* respect null terminator */
+ let i = s.indexOf(0);
+ if (i !== -1)
+ s = s.slice(0, i);
+ }
pushstr(L, s);
break;
}