Skip to content

Commit a47f5e4

Browse files
Fix lua UAF (CVE-2025-49844)
Fix lua UAF bug (CVE-2025-49844 - Redishell)
1 parent cb9b4d4 commit a47f5e4

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

app/redis-6.2.6/deps/lua/src/lparser.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,13 +384,17 @@ Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, const char *name) {
384384
struct LexState lexstate;
385385
struct FuncState funcstate;
386386
lexstate.buff = buff;
387-
luaX_setinput(L, &lexstate, z, luaS_new(L, name));
387+
TString *tname = luaS_new(L, name);
388+
setsvalue2s(L, L->top, tname);
389+
incr_top(L);
390+
luaX_setinput(L, &lexstate, z, tname);
388391
open_func(&lexstate, &funcstate);
389392
funcstate.f->is_vararg = VARARG_ISVARARG; /* main func. is always vararg */
390393
luaX_next(&lexstate); /* read first token */
391394
chunk(&lexstate);
392395
check(&lexstate, TK_EOS);
393396
close_func(&lexstate);
397+
--L->top;
394398
lua_assert(funcstate.prev == NULL);
395399
lua_assert(funcstate.f->nups == 0);
396400
lua_assert(lexstate.fs == NULL);

0 commit comments

Comments
 (0)