Skip to content

Commit

Permalink
scrobbler2: Fix XML parsing of Last.fm API responses
Browse files Browse the repository at this point in the history
Due to an off-by-one-error newer libxml2 versions failed to parse valid XML.
Parser error: "Extra content at the end of the document"

See also: https://github.com/orgs/audacious-media-player/discussions/100
  • Loading branch information
radioactiveman committed Jan 13, 2024
1 parent 6009062 commit 5103ba0
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/scrobbler2/scrobbler_xml_parsing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ static gboolean prepare_data () {
received_data[received_data_size] = '\0';
AUDDBG("Data received from last.fm:\n%s\n%%%%End of data%%%%\n", received_data);

doc = xmlReadMemory(received_data, received_data_size+1, nullptr, nullptr, 0);
doc = xmlReadMemory(received_data, received_data_size, nullptr, nullptr, 0);
received_data_size = 0;
if (doc == nullptr) {
AUDDBG("Document not parsed successfully.\n");
Expand Down Expand Up @@ -297,4 +297,3 @@ gboolean read_session_key(String &error_code, String &error_detail) {
clean_data();
return result;
}

0 comments on commit 5103ba0

Please sign in to comment.