From e84db4f411890528f6f1302e618db5cd57705a19 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 30 Apr 2023 08:41:59 +0200 Subject: [PATCH] db/update/Archive: ignore filenames with newline character --- src/db/update/Archive.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/db/update/Archive.cxx b/src/db/update/Archive.cxx index 9dee7dfdf..84b57d9ef 100644 --- a/src/db/update/Archive.cxx +++ b/src/db/update/Archive.cxx @@ -39,7 +39,9 @@ LockFindSong(Directory &directory, std::string_view name) noexcept static bool IsAcceptableFilename(std::string_view name) noexcept { - return !name.empty(); + return !name.empty() && + /* newlines cannot be represented in MPD's protocol */ + name.find('\n') == name.npos; } void