From 9f24e4363f451b5fb10d13a095f651747e513b91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Tue, 11 Nov 2025 15:16:12 +0800 Subject: [PATCH] Media (Linux): handles invalid percent-encoding in cover metadata --- src/detection/media/media_linux.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/detection/media/media_linux.c b/src/detection/media/media_linux.c index 7bd2d2ff8..37b19048e 100644 --- a/src/detection/media/media_linux.c +++ b/src/detection/media/media_linux.c @@ -86,9 +86,15 @@ static bool parseMprisMetadata(FFDBusData* data, DBusMessageIter* rootIterator, if (i + 2 >= path.length) break; char str[] = { path.chars[i + 1], path.chars[i + 2], 0 }; - const char decodedChar = (char) strtoul(str, NULL, 16); - i += 2; - ffStrbufAppendC(&result->cover, decodedChar); + char* end = NULL; + const char decodedChar = (char) strtoul(str, &end, 16); + if (end == &str[2]) + { + i += 2; + ffStrbufAppendC(&result->cover, decodedChar); + } + else + ffStrbufAppendC(&result->cover, '%'); } else {