]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Avoid null-bytes in Log-Tag header value. 5179/head
authorSebastian Marsching <sebastian-git-2016@marsching.com>
Tue, 8 Oct 2024 19:05:35 +0000 (21:05 +0200)
committerSebastian Marsching <sebastian-git-2016@marsching.com>
Tue, 8 Oct 2024 19:05:35 +0000 (21:05 +0200)
This fixes #5178.

src/rspamd_proxy.c

index dbdd2e5a7a5ce6f729a2a3366f6dfed739757cae..e2a8661783b8f2d28340c1118da15f6bd81f021c 100644 (file)
@@ -38,6 +38,7 @@
 #include "libmime/lang_detection.h"
 
 #include <math.h>
+#include <string.h>
 
 #ifdef HAVE_NETINET_TCP_H
 #include <netinet/tcp.h> /* for TCP_NODELAY */
@@ -2205,7 +2206,7 @@ proxy_client_finish_handler(struct rspamd_http_connection *conn,
                rspamd_http_message_remove_header(msg, "Connection");
                rspamd_http_message_remove_header(msg, "Key");
                rspamd_http_message_add_header_len(msg, LOG_TAG_HEADER, session->pool->tag.uid,
-                                                                                  sizeof(session->pool->tag.uid));
+                                                                                  strnlen(session->pool->tag.uid, sizeof(session->pool->tag.uid)));
 
                proxy_open_mirror_connections(session);
                rspamd_http_connection_reset(session->client_conn);