lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Thank you for the pointers.

API users are free to assume that strings will always have a
terminating null: "lua_tolstring returns a fully aligned pointer to a
string inside the Lua state. This string always has a zero ('\0')
after its last character (as in C), but may contain other zeros in its
body".

This is a non-problem, since there are no API users.

Some parts of the standard string library (specifically parts of the
pattern matching code) will also break without a terminating null.

I grepped for strlen and printf and looks like there indeed is some
non-trivial code that expects lua_tolstring to return proper C strings,
like in the str_format function. Will try to figure it out.

Thanks,
--j<