]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: db-lua - Check for nil in auth_request_lua_password_verify()
authorAki Tuomi <aki.tuomi@open-xchange.com>
Tue, 9 May 2023 08:20:59 +0000 (11:20 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Fri, 19 May 2023 09:25:44 +0000 (09:25 +0000)
Avoids crash if script calls the function with nil values.

src/auth/db-lua.c

index e086307c2ece1830c1c38b1ee845bb661cde95a9..c0b22d73728879f85c374da996c8df8354fc7f78 100644 (file)
@@ -193,6 +193,10 @@ static int auth_request_lua_password_verify(lua_State *L)
        const unsigned char *raw_password = NULL;
        size_t raw_password_size;
        int ret;
+       if (crypted_password == NULL)
+               return luaL_error(L, "Crypted password must not be nil");
+       if (plain_password == NULL)
+               return luaL_error(L, "Plain password must not be nil");
        struct password_generate_params gen_params = {
                .user = request->fields.original_username,
                .rounds = 0