From 74e8f0076bcc78fc34a1e44de386ddbf79628159 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 24 Apr 2020 21:42:11 +0100 Subject: [PATCH] [Minor] Workaround for \0 character (poor API choice) --- src/controller.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/controller.c b/src/controller.c index 8440beb8e0..1f8524b844 100644 --- a/src/controller.c +++ b/src/controller.c @@ -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 -- 2.47.3