Mercurial > prosody-hg
diff util-src/crypto.c @ 14178:af87d31dcae4 13.0
util.crypto: Ensure signing parameter is a string
lua_tostring() returns NULL if the specified value is missing or can't become
a string. luaL_checkstring() will raise an error.
We prefer the latter behaviour, otherwise we end up passing NULL to OpenSSL.
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Mon, 25 May 2026 14:51:15 +0100 |
| parents | fb970df95374 |
| children | 25beb66fab38 |
line wrap: on
line diff
--- a/util-src/crypto.c Mon May 25 14:44:20 2026 +0100 +++ b/util-src/crypto.c Mon May 25 14:51:15 2026 +0100 @@ -132,7 +132,7 @@ luaL_Buffer sigbuf; size_t msg_len; - const unsigned char* msg = (unsigned char*)lua_tolstring(L, 2, &msg_len); + const unsigned char* msg = (unsigned char*)luaL_checklstring(L, 2, &msg_len); size_t sig_len; unsigned char *sig = NULL;
