From 8ca4dfdb3e3deaa5246c1e339e773c90d2db7451 Mon Sep 17 00:00:00 2001 From: Andreas Obergrusberger Date: Sun, 17 Jun 2007 12:19:39 +0000 Subject: [PATCH] 2 critical bugs in leoslyrics lyrics src fixed git-svn-id: https://svn.musicpd.org/ncmpc/branches/tradiaz@6630 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- ChangeLog | 2 ++ configure.ac | 1 + plugins/leoslyrics/lyrics_leoslyrics.c | 7 ++++++- src/lyrics_leoslyrics.c | 9 +++++++-- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 715a4ca..4ff8da5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,5 @@ +2007-06-17 Andreas Obergrusberger + * two critical bugs in leoslyrics source have been fixed 2007-02-16 Andreas Obergrusberger + nj has posted a lot of patches on the bug tracker * added the option to search for artist and title at the same time diff --git a/configure.ac b/configure.ac index d24c4a5..3ffc870 100644 --- a/configure.ac +++ b/configure.ac @@ -449,3 +449,4 @@ AC_CONFIG_FILES([Makefile src/Makefile plugins/Makefile doc/Makefile po/Makefile plugins/hd/Makefile plugins/leoslyrics/Makefile]) AC_OUTPUT +AC_MSG_WARN([TO BUILD AN INSTALL THE PLUGINS cd TO THE plugins DIRECTORY AND EXECUTE make && make install THERE]) diff --git a/plugins/leoslyrics/lyrics_leoslyrics.c b/plugins/leoslyrics/lyrics_leoslyrics.c index a62e47f..5bcb322 100644 --- a/plugins/leoslyrics/lyrics_leoslyrics.c +++ b/plugins/leoslyrics/lyrics_leoslyrics.c @@ -50,7 +50,7 @@ static void check_search_response(void *data, const char *name, { if(strstr(atts[2], "hid") != NULL) { - hid = atts[3]; + hid = strdup (atts[3]); } if(strstr(atts[2], "exactMatch") != NULL) @@ -120,6 +120,11 @@ int check_lyr_leoslyrics(char *artist, char *title, char *url) XML_ParserFree(parser); if(!(result & 4)) return -1; //check whether lyrics found + + CURL *curl = curl_easy_init (); + char *esc_hid = curl_easy_escape (curl, hid, 0); + free (hid); + snprintf(url, 512, LEOSLYRICS_CONTENT_URL, hid); return 0; diff --git a/src/lyrics_leoslyrics.c b/src/lyrics_leoslyrics.c index 3b85e68..4afb3fa 100644 --- a/src/lyrics_leoslyrics.c +++ b/src/lyrics_leoslyrics.c @@ -50,7 +50,7 @@ static void check_search_response(void *data, const char *name, { if(strstr(atts[2], "hid") != NULL) { - hid = atts[3]; + hid = strdup (atts[3]); } if(strstr(atts[2], "exactMatch") != NULL) @@ -120,7 +120,12 @@ int check_lyr_leoslyrics(char *artist, char *title, char *url) XML_ParserFree(parser); if(!(result & 4)) return -1; //check whether lyrics found - snprintf(url, 512, LEOSLYRICS_CONTENT_URL, hid); + + CURL *curl = curl_easy_init (); + char *esc_hid = curl_easy_escape (curl, hid, 0); + free (hid); + + snprintf(url, 512, LEOSLYRICS_CONTENT_URL, esc_hid); return 0; } -- 2.30.2