]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
avoid off-by-one when at the maximum tag length 5778/head
authorAlex Maestas <alex.maestas@zendesk.com>
Thu, 4 Dec 2025 16:25:31 +0000 (08:25 -0800)
committerAlex Maestas <alex.maestas@zendesk.com>
Thu, 4 Dec 2025 16:25:31 +0000 (08:25 -0800)
src/libserver/protocol.c

index ccf26977d343a100874de4bd4cb1f434d7096825..83bcb6e2a8767aba6f2c302e2169ff64d4e760d5 100644 (file)
@@ -713,7 +713,7 @@ rspamd_protocol_handle_headers(struct rspamd_task *task,
                                msg_debug_protocol("read log-tag header, value: %T", hv_tok);
                                /* Ensure that a tag is valid */
                                if (rspamd_fast_utf8_validate(hv_tok->begin, hv_tok->len) == 0) {
-                                       int len = MIN(hv_tok->len, sizeof(task->task_pool->tag.uid));
+                                       int len = MIN(hv_tok->len, sizeof(task->task_pool->tag.uid) - 1);
                                        memcpy(task->task_pool->tag.uid, hv_tok->begin, len);
                                        task->task_pool->tag.uid[len] = '\0';
                                }