From a93d10271d0d6c1c1766fcaf42e8ad4015dce8c8 Mon Sep 17 00:00:00 2001 From: anod221 Date: Thu, 30 Aug 2018 14:21:11 +0800 Subject: [PATCH] make write cstring as c-string. --- bytearr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bytearr.c b/bytearr.c index 554961f..1e6a93e 100644 --- a/bytearr.c +++ b/bytearr.c @@ -776,7 +776,7 @@ static int lbytearr_writestr( lua_State *L ) const char *pstr = lua_tostring(L, 2); uint8_t *str = &getBuffer(p)[getPosition(p)]; - size_t l = 1 + lua_objlen(L, 2); + size_t l = 1 + strlen(pstr); handle_scope_except();