diff options
author | daurnimator <quae@daurnimator.com> | 2017-12-12 14:31:31 +1100 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2017-12-12 14:31:39 +1100 |
commit | 8dfdad3ee84a73ec7da2312e8c8d893dd8968d17 (patch) | |
tree | 29566aa7db102487baa0381a411db8e1161cfce5 /src | |
parent | 3355a611f2c30b338e55cc2407b02cc28fe437c5 (diff) | |
download | fengari-8dfdad3ee84a73ec7da2312e8c8d893dd8968d17.tar.gz fengari-8dfdad3ee84a73ec7da2312e8c8d893dd8968d17.tar.bz2 fengari-8dfdad3ee84a73ec7da2312e8c8d893dd8968d17.zip |
src/lobject.js: Have luaO_pushvfstring respect null as terminator for %s
Diffstat (limited to 'src')
-rw-r--r-- | src/lobject.js | 6 |
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; } |