From: Alex Maestas Date: Thu, 4 Dec 2025 16:25:31 +0000 (-0800) Subject: avoid off-by-one when at the maximum tag length X-Git-Tag: 3.14.2~34^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0209dcd1d800483f81111f1d55c47c9786c49c78;p=thirdparty%2Frspamd.git avoid off-by-one when at the maximum tag length --- diff --git a/src/libserver/protocol.c b/src/libserver/protocol.c index ccf26977d3..83bcb6e2a8 100644 --- a/src/libserver/protocol.c +++ b/src/libserver/protocol.c @@ -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'; }