fix[base]: Fix strncpy compile warning

Change-Id: I8c282e20251b2e3e7ea0f67bf0a89bb0dc0fb6a9
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
This commit is contained in:
Herman Chen
2025-03-17 17:27:28 +08:00
parent 1b0aef1de8
commit 729e57a6d7
2 changed files with 2 additions and 2 deletions

View File

@@ -427,7 +427,7 @@ MPP_RET mpp_buffer_create(const char *tag, const char *caller,
if (NULL == tag)
tag = group->tag;
strncpy(p->tag, tag, sizeof(p->tag));
strncpy(p->tag, tag, sizeof(p->tag) - 1);
p->caller = caller;
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);

View File

@@ -189,7 +189,7 @@ MppMetaImpl *MppMetaService::get_meta(const char *tag, const char *caller)
const char *tag_src = (tag) ? (tag) : (MODULE_TAG);
RK_U32 i;
strncpy(impl->tag, tag_src, sizeof(impl->tag));
strncpy(impl->tag, tag_src, sizeof(impl->tag) - 1);
impl->caller = caller;
impl->meta_id = MPP_FETCH_ADD(&meta_id, 1);
INIT_LIST_HEAD(&impl->list_meta);