archive/{zzip,iso9660}: ignore file names which are invalid UTF-8
These malformed strings must not be transferred over the wire, because the MPD protocol is defined to be UTF-8. Closes https://github.com/MusicPlayerDaemon/MPD/issues/1274
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
#include "fs/Path.hxx"
|
||||
#include "util/RuntimeError.hxx"
|
||||
#include "util/StringCompare.hxx"
|
||||
#include "util/UTF8.hxx"
|
||||
#include "util/WritableBuffer.hxx"
|
||||
|
||||
#include <cdio/iso9660.h>
|
||||
@@ -102,6 +103,10 @@ Iso9660ArchiveFile::Visit(char *path, size_t length, size_t capacity,
|
||||
/* skip special names like "." and ".." */
|
||||
continue;
|
||||
|
||||
if (!ValidateUTF8(filename))
|
||||
/* ignore file names which are not valid UTF-8 */
|
||||
continue;
|
||||
|
||||
size_t filename_length = strlen(filename);
|
||||
if (length + filename_length + 1 >= capacity)
|
||||
/* file name is too long */
|
||||
|
Reference in New Issue
Block a user