From: Vsevolod Stakhov Date: Fri, 24 Apr 2020 20:42:11 +0000 (+0100) Subject: [Minor] Workaround for \0 character (poor API choice) X-Git-Tag: 2.6~488 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=74e8f0076bcc78fc34a1e44de386ddbf79628159;p=thirdparty%2Frspamd.git [Minor] Workaround for \0 character (poor API choice) --- 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