From: Gabriel BenHanokh Date: Sun, 26 Oct 2025 15:51:53 +0000 (+0200) Subject: rgw/dedup: fixes an assertion failure from __snprintf_chk in fortified mode when... X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=27e27f55d69050ee0fe9f56a437af2fffd07a333;p=ceph-ci.git rgw/dedup: fixes an assertion failure from __snprintf_chk in fortified mode when handling dedup cluster shard token OIDs. The issue stems from buffer size validation in string operations. Resolves: rhbz#2405986 Signed-off-by: Gabriel BenHanokh --- diff --git a/src/rgw/rgw_dedup_cluster.h b/src/rgw/rgw_dedup_cluster.h index 70017a00684..7a277bf91d9 100644 --- a/src/rgw/rgw_dedup_cluster.h +++ b/src/rgw/rgw_dedup_cluster.h @@ -43,13 +43,13 @@ namespace rgw::dedup { //--------------------------------------------------------------------------- void set_shard(uint16_t shard) { - int n = snprintf(this->buff + this->prefix_len, BUFF_SIZE, "%03x", shard); + int n = snprintf(this->buff + this->prefix_len, BUFF_SIZE - this->prefix_len, "%03x", shard); this->total_len = this->prefix_len + n; } //--------------------------------------------------------------------------- static bool legal_oid_name(const std::string& oid) { - return ((oid.length() <= BUFF_SIZE) && + return ((oid.length() < BUFF_SIZE) && (oid.starts_with(WORKER_SHARD_PREFIX)||oid.starts_with(MD5_SHARD_PREFIX))); } inline const char* get_buff() { return this->buff; }