lua-users home
lua-l archive

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


>From lua-l@tecgraf.puc-rio.br  Wed May 31 18:43:58 2000
>From: Jim Mathies <Jim@mathies.com>
>
>How can this be with system string calls like strlen and strncpy
>and strcpy in the lua source?  If the strlen or stcpy are the
>ascii type, this will not work on strings with null bytes.

If you look closer, you'll see that -- except in one place -- these functions
are used on normal, 0-terminated, C strings. Here is a complete list of uses
of these functions in Lua 4.0a:

lauxlib.c	strchr
lauxlib.c	strcmp
lauxlib.c	strncpy
lbuiltin.c	strcat
lbuiltin.c	strchr
liolib.c	strcat
llex.c		strcpy
lstrlib.c	strncpy
lstrlib.c	strpbrk
lvm.c		strcoll

The only place I could find in a quick scan of these files that uses a str*
function on Lua strings was the use of strcoll in lvm.c, but there the code
very carefully handles embedded zeros.
--lhf