mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-18 15:32:33 +00:00
Merge branch 'fix-buffer-overflow-gettexturefornum' into 'next'
Fix buffer overflow when reading string from R_TextureNameForNum into Lua Closes #1341 See merge request STJr/SRB2!2582
This commit is contained in:
commit
a30637a505
1 changed files with 10 additions and 2 deletions
|
@ -3181,17 +3181,25 @@ static int lib_rTextureNumForName(lua_State *L)
|
|||
|
||||
static int lib_rCheckTextureNameForNum(lua_State *L)
|
||||
{
|
||||
char s[9];
|
||||
INT32 num = (INT32)luaL_checkinteger(L, 1);
|
||||
//HUDSAFE
|
||||
lua_pushstring(L, R_CheckTextureNameForNum(num));
|
||||
|
||||
M_Memcpy(s, R_CheckTextureNameForNum(num), 8);
|
||||
s[8] = '\0';
|
||||
lua_pushstring(L, s);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_rTextureNameForNum(lua_State *L)
|
||||
{
|
||||
char s[9];
|
||||
INT32 num = (INT32)luaL_checkinteger(L, 1);
|
||||
//HUDSAFE
|
||||
lua_pushstring(L, R_TextureNameForNum(num));
|
||||
|
||||
M_Memcpy(s, R_TextureNameForNum(num), 8);
|
||||
s[8] = '\0';
|
||||
lua_pushstring(L, s);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue