lua-users home
lua-l archive

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

On 08.11.2011 11:30, Daurnimator wrote:


Byte arrays may also be initialized with a Lua string. This copies the
whole string plus a terminating zero-byte. The copy stops early only
if the array has a known, fixed size.

I guess a VLA (A variable-length array) is not of a known, fixed size.
(though I guess it should be.....)

My reasoning is: I'm using nelem
( to copy a string that
represents raw bytes (and has no reason to be \0-terminated).
It should behave approximately like strncpy().

But what I find the most strange is that the segfault doesn't happen
at that line, it happens later when the memory is garbage collected.

Pierre Chapuis