]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Workaround for \0 character (poor API choice)
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 24 Apr 2020 20:42:11 +0000 (21:42 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 24 Apr 2020 20:42:11 +0000 (21:42 +0100)
src/controller.c

index 8440beb8e0f9927b3023aeff7c7aa461bb2e36c7..1f8524b84416cd6d85cd32735c7c511883576db4 100644 (file)
@@ -3467,7 +3467,10 @@ rspamd_controller_register_plugin_path (lua_State *L,
        rspamd_http_router_add_path (ctx->http,
                        full_path->str,
                        rspamd_controller_handle_lua_plugin);
-       g_hash_table_insert (ctx->plugins, rspamd_ftok_map (full_path), cbd);
+       rspamd_ftok_t *key_tok = rspamd_ftok_map (full_path);
+       /* Truncate stupid \0 symbol to enable lookup */
+       key_tok->len --;
+       g_hash_table_insert (ctx->plugins, key_tok, cbd);
 }
 
 static void