Skip to content

Commit

Permalink
check end pointer for validity before decoding a string
Browse files Browse the repository at this point in the history
  • Loading branch information
mbalmer committed Feb 20, 2016
1 parent 644077e commit fcd705a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion luajson.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit fcd705a

Please sign in to comment.