[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: lua_error and brain lock
- From: Norman Ramsey <nr@...>
- Date: Tue, 23 Jun 1998 13:18:20 -0400
Lhf wrote...
> void luaL_verror (char *fmt, ...)
> {
> char buff[500];
> va_list argp;
> va_start(argp, fmt);
> vsprintf(buff, fmt, argp);
> va_end(argp);
> lua_error(buff);
> }
>
> Unfortunately, until the new ANSI C is out, there is no way to avoid the
> fixed size buffer and the danger for overflow in vsprintf.
And in my followup I forgot to mention that a solution to this problem
already exists in Lua: it is called `format', and it takes care of
allocating a buffer of the correct size. It just needs to be exposed
in the C API.
Norman