From 0414d1fe801059d09d3cdd7df777438c4d2e0e83 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Fri, 16 Jun 2017 11:38:20 +0200 Subject: packint: Fixed how we search for 0 in Kzstr --- src/lstrlib.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/lstrlib.js b/src/lstrlib.js index c22474f..f48d859 100644 --- a/src/lstrlib.js +++ b/src/lstrlib.js @@ -617,7 +617,7 @@ const str_pack = function(L) { case KOption.Kzstr: { /* zero-terminated string */ let s = lauxlib.luaL_checkstring(L, arg); let len = s.length; - lauxlib.luaL_argcheck(L, s.length === String.fromCharCode(...s).length, arg, lua.to_luastring("strings contains zeros", true)); + lauxlib.luaL_argcheck(L, s.indexOf(0) < 0, arg, lua.to_luastring("strings contains zeros", true)); b.push(...s); b.push(0); /* add zero at the end */ totalsize += len + 1; -- cgit v1.2.3-70-g09d2