commit 74e8f00: [Minor] Workaround for \0 character (poor API choice)

Vsevolod Stakhov vsevolod at highsecure.ru
Fri Apr 24 20:49:07 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-04-24 21:42:11 +0100
URL: https://github.com/rspamd/rspamd/commit/74e8f0076bcc78fc34a1e44de386ddbf79628159 (HEAD -> master)

[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 8440beb8e..1f8524b84 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


More information about the Commits mailing list