From fcd705ae7e56e41a50bd0d6964ee0d6a8fe7fb89 Mon Sep 17 00:00:00 2001 From: Marc Balmer Date: Sat, 20 Feb 2016 09:24:18 +0100 Subject: [PATCH] check end pointer for validity before decoding a string --- luajson.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/luajson.c b/luajson.c index 8559603..5ee2e93 100644 --- a/luajson.c +++ b/luajson.c @@ -200,6 +200,8 @@ decode_string(lua_State *L, char **s) if (**s == '"' && (*((*s) - 1) != '\\')) end = *s; } + if (end == NULL) + return; *s = beginning; len = strlen(*s); newstr = malloc(len + 1); @@ -562,7 +564,7 @@ json_set_info(lua_State *L) lua_pushliteral(L, "JSON encoder/decoder for Lua"); lua_settable(L, -3); lua_pushliteral(L, "_VERSION"); - lua_pushliteral(L, "json 1.2.5"); + lua_pushliteral(L, "json 1.2.6"); lua_settable(L, -3); }