diff --git a/playlist.c b/playlist.c index 0d2f2587e6..47db96a4db 100644 --- a/playlist.c +++ b/playlist.c @@ -463,9 +463,13 @@ static bool playlist_read_file( if (!filestream_gets(file, buf[i], sizeof(buf[i]))) goto end; - last = strrchr(buf[i], '\n'); - if (last) - *last = '\0'; + /* Read playlist entry and terminate string with NUL character + * regardless of Windows or Unix line endings + */ + if((last = strrchr(buf[i], '\r'))) + *last = '\0'; + else if((last = strrchr(buf[i], '\n'))) + *last = '\0'; } entry = &playlist->entries[playlist->size];