From ee5505430ea8773c77880649539c6d8f3da849ab Mon Sep 17 00:00:00 2001 From: ctf Date: Thu, 16 Apr 2026 09:31:37 +0800 Subject: [PATCH] tools: replace strcpy with memcpy Potential buffer overflow in metadata_property function when copying strings. Fixes buffer overflow issue in string copying. --- src/tools/pw-dump.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/tools/pw-dump.c b/src/tools/pw-dump.c index 09643aa43..a870e4df0 100644 --- a/src/tools/pw-dump.c +++ b/src/tools/pw-dump.c @@ -1107,12 +1107,12 @@ static int metadata_property(void *data, e->subject = subject; e->key = SPA_PTROFF(e, sizeof(*e), void); - strcpy(e->key, key); - e->value = SPA_PTROFF(e->key, strlen(e->key) + 1, void); - strcpy(e->value, value); + memcpy(e->key, key, strlen(key) + 1); + e->value = SPA_PTROFF(e->key, strlen(key) + 1, void); + memcpy(e->value, value, strlen(value) + 1); if (type) { - e->type = SPA_PTROFF(e->value, strlen(e->value) + 1, void); - strcpy(e->type, type); + e->type = SPA_PTROFF(e->value, strlen(value) + 1, void); + memcpy(e->type, type, strlen(type) + 1); } else { e->type = NULL; }