aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatarLibravatar daurnimator <quae@daurnimator.com> 2021-04-10 23:13:02 +1000
committerLibravatarLibravatar daurnimator <quae@daurnimator.com> 2021-04-10 23:13:02 +1000
commit1054d12f23ecd177881b1bcb6ade92f247cc01e9 (patch)
tree6b67dee857c24f1e2361d0a1eda5a8fd63c3c089 /src
parent4783a545e62b0eb51e0ac2de3caf71619870541c (diff)
downloadluaossl-1054d12f23ecd177881b1bcb6ade92f247cc01e9.tar.gz
luaossl-1054d12f23ecd177881b1bcb6ade92f247cc01e9.tar.bz2
luaossl-1054d12f23ecd177881b1bcb6ade92f247cc01e9.zip
src/openssl.c: save top before calling luaL_buffinit
Diffstat (limited to 'src')
-rw-r--r--src/openssl.c6
1 files changed, 4 insertions, 2 deletions
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);