mirror of
https://github.com/lua/lua.git
synced 2024-11-30 21:53:26 +08:00
redefine 'l_sprintf' to test correctness of buffer sizes given
to 'snprintf'
This commit is contained in:
parent
19eb6ae580
commit
95c3144393
11
ltests.h
11
ltests.h
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: ltests.h,v 2.46 2014/12/19 13:33:06 roberto Exp roberto $
|
||||
** $Id: ltests.h,v 2.47 2014/12/26 14:44:44 roberto Exp roberto $
|
||||
** Internal Header for Debugging of the Lua Implementation
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -37,6 +37,15 @@
|
||||
#define UNUSED(x) (x=0, (void)(x))
|
||||
|
||||
|
||||
/* test for sizes in 'l_sprintf' (make sure whole buffer is available) */
|
||||
#undef l_sprintf
|
||||
#if !defined(LUA_USE_C89)
|
||||
#define l_sprintf(s,sz,f,i) (memset(s,0xAB,sz), snprintf(s,sz,f,i))
|
||||
#else
|
||||
#define l_sprintf(s,sz,f,i) (memset(s,0xAB,sz), sprintf(s,f,i))
|
||||
#endif
|
||||
|
||||
|
||||
/* memory-allocator control variables */
|
||||
typedef struct Memcontrol {
|
||||
unsigned long numblocks;
|
||||
|
Loading…
Reference in New Issue
Block a user