From 1054d12f23ecd177881b1bcb6ade92f247cc01e9 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Sat, 10 Apr 2021 23:13:02 +1000 Subject: src/openssl.c: save top before calling luaL_buffinit --- src/openssl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/openssl.c b/src/openssl.c index 1f0f5e4..b56c78a 100644 --- a/src/openssl.c +++ b/src/openssl.c @@ -11929,10 +11929,11 @@ static _Bool cipher_update_(lua_State *L, EVP_CIPHER_CTX *ctx, luaL_Buffer *B, i static int cipher_update(lua_State *L) { EVP_CIPHER_CTX *ctx = checksimple(L, 1, CIPHER_CLASS); luaL_Buffer B; + int top = lua_gettop(L); luaL_buffinit(L, &B); - if (!cipher_update_(L, ctx, &B, 2, lua_gettop(L))) + if (!cipher_update_(L, ctx, &B, 2, top)) goto sslerr; luaL_pushresult(&B); @@ -11951,10 +11952,11 @@ static int cipher_final(lua_State *L) { luaL_Buffer B; size_t block; int out; + int top = lua_gettop(L); luaL_buffinit(L, &B); - if (!cipher_update_(L, ctx, &B, 2, lua_gettop(L))) + if (!cipher_update_(L, ctx, &B, 2, top)) goto sslerr; block = EVP_CIPHER_CTX_block_size(ctx); -- cgit v1.2.3-59-g8ed1b