]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Use correct type for keylen in lua_ucl_newindex 5169/head
authorPetr Vaněk <arkamar@atlas.cz>
Wed, 2 Oct 2024 13:01:07 +0000 (15:01 +0200)
committerPetr Vaněk <arkamar@atlas.cz>
Wed, 2 Oct 2024 13:17:42 +0000 (15:17 +0200)
The keylen variable used in lua_ucl_newindex function should use size_t
type instead of lua_Integer, because all functions that use keylen
expect it to be of size_t type. This mismatch leads to incompatible
pointer types, and modern versions of GCC fail to compile the code.

Fixes: 9e87597ceb05 ("[Project] Allow manipulations with opaque UCL objects")
Issue: https://github.com/rspamd/rspamd/issues/5163

contrib/libucl/lua_ucl.c

index 19ac9cb1277fa35d1248e6a8e6cb60e033e5d11b..473aefe0cf68b1009964ca78bbe058aa1b8be967 100644 (file)
@@ -1426,7 +1426,7 @@ lua_ucl_newindex(lua_State *L)
 
        if (ucl_object_type(obj) == UCL_OBJECT) {
                if (key_type == LUA_TSTRING) {
-                       lua_Integer keylen;
+                       size_t keylen;
                        const char *key = lua_tolstring(L, 2, &keylen);
 
                        ucl_object_t *value_obj = lua_ucl_object_get(L, 3);
@@ -1539,7 +1539,7 @@ lua_ucl_newindex(lua_State *L)
                        obj->value.av = NULL;
                        obj->type = UCL_OBJECT;
 
-                       lua_Integer keylen;
+                       size_t keylen;
                        const char *key = lua_tolstring(L, 2, &keylen);
 
                        ucl_object_t *value_obj = lua_ucl_object_get(L, 3);