Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LuaWrapper: Allow embedded NULs in strings received from Lua #5147

Merged
merged 1 commit into from Mar 15, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions ext/luawrapper/include/LuaContext.hpp
Expand Up @@ -2486,10 +2486,11 @@ struct LuaContext::Reader<std::string>
static auto read(lua_State* state, int index)
-> boost::optional<std::string>
{
const auto val = lua_tostring(state, index);
size_t len;
const auto val = lua_tolstring(state, index, &len);
if (val == 0)
return boost::none;
return std::string(val);
return std::string(val, len);
}
};

Expand Down