mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-27 23:55:57 -05:00
[mpd] Sanitize newline characters in ID3 tag values (#1615)
Fixes https://github.com/owntone/owntone-server/issues/1613
This commit is contained in:
parent
2ad680a96b
commit
469fcf6707
22
src/mpd.c
22
src/mpd.c
@ -2721,6 +2721,27 @@ mpd_command_findadd(struct evbuffer *evbuf, int argc, char **argv, char **errmsg
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Some MPD clients crash if the tag value includes the newline character.
|
||||
* While they should normally not be included in most ID3 tags, they sometimes
|
||||
* are, so we just change them to space. See #1613 for more details.
|
||||
*/
|
||||
|
||||
static void
|
||||
sanitize_value(char **strval)
|
||||
{
|
||||
char *ptr = *strval;
|
||||
|
||||
while(*ptr != '\0')
|
||||
{
|
||||
if(*ptr == '\n')
|
||||
{
|
||||
*ptr = ' ';
|
||||
}
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
mpd_command_list(struct evbuffer *evbuf, int argc, char **argv, char **errmsg, struct mpd_client_ctx *ctx)
|
||||
{
|
||||
@ -2784,6 +2805,7 @@ mpd_command_list(struct evbuffer *evbuf, int argc, char **argv, char **errmsg, s
|
||||
if (!(*strval) || (**strval == '\0'))
|
||||
continue;
|
||||
|
||||
sanitize_value(strval);
|
||||
evbuffer_add_printf(evbuf,
|
||||
"%s: %s\n",
|
||||
tagtype->tag,
|
||||
|
Loading…
Reference in New Issue
Block a user