]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Check type of map more strictly
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 2 Sep 2017 12:13:22 +0000 (13:13 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 2 Sep 2017 12:13:22 +0000 (13:13 +0100)
src/lua/lua_map.c

index 3e292f4d3e56f4cb411d6cbeabe95fa07af92b83..6300216de03a4dd7aba15d6bd4650ae1a15b8a7a 100644 (file)
@@ -384,9 +384,12 @@ lua_config_add_map (lua_State *L)
 
                g_assert (map_obj != NULL);
 
-               if (type == NULL) {
+               if (type == NULL && cbidx != -1) {
                        type = "callback";
                }
+               else if (type == NULL) {
+                       return luaL_error (L, "invalid map type");
+               }
 
                if (strcmp (type, "callback") == 0) {
                        map = rspamd_mempool_alloc0 (cfg->cfg_pool, sizeof (*map));