From eafdbc018fbeeec088b82172ff59a413558e92e7 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Fri, 24 Mar 2017 10:31:48 +0100 Subject: jsstring does not stop on '\0' --- src/lobject.js | 1 + 1 file changed, 1 insertion(+) (limited to 'src/lobject.js') diff --git a/src/lobject.js b/src/lobject.js index d713183..8d6b6a3 100644 --- a/src/lobject.js +++ b/src/lobject.js @@ -127,6 +127,7 @@ class TValue { while (1) { // For UTF8 byte structure, see http://en.wikipedia.org/wiki/UTF-8#Description and https://www.ietf.org/rfc/rfc2279.txt and https://tools.ietf.org/html/rfc3629 u0 = value[idx++]; + if (u0 === 0) { str += "\0"; continue; } // Lua string embed '\0' if (!u0) return str; if (!(u0 & 0x80)) { str += String.fromCharCode(u0); continue; } u1 = value[idx++] & 63; -- cgit v1.2.3-54-g00ecf