db/update/Archive: ignore filenames with newline character

This commit is contained in:
Max Kellermann 2023-04-30 08:41:59 +02:00
parent 395bf34a91
commit e84db4f411
1 changed files with 3 additions and 1 deletions

View File

@ -39,7 +39,9 @@ LockFindSong(Directory &directory, std::string_view name) noexcept
static bool static bool
IsAcceptableFilename(std::string_view name) noexcept 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 void