Mercurial > audlegacy-plugins
diff src/scrobbler/gerpok.c @ 786:c23705487009 trunk
[svn] - avoid crash when error message doesn't contain <TITLE>.
author | yaz |
---|---|
date | Tue, 06 Mar 2007 05:17:29 -0800 |
parents | 7c04570bf809 |
children | 238055a6cb8f |
line wrap: on
line diff
--- a/src/scrobbler/gerpok.c Tue Mar 06 04:44:26 2007 -0800 +++ b/src/scrobbler/gerpok.c Tue Mar 06 05:17:29 2007 -0800 @@ -544,13 +544,16 @@ } if (!strncmp(gerpok_sc_srv_res, "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">", 50)) { - ch = strstr(gerpok_sc_srv_res, "<TITLE>") + 7; + ch = strstr(gerpok_sc_srv_res, "<TITLE>"); ch2 = strstr(gerpok_sc_srv_res, "</TITLE>"); - *ch2 = '\0'; + if (ch != NULL && ch2 != NULL) { + ch += strlen("<TITLE>"); + *ch2 = '\0'; - pdebug(fmt_vastr("HTTP Error (%d): '%s'", - atoi(ch), ch + 4), DEBUG); - *ch2 = '<'; + pdebug(fmt_vastr("HTTP Error (%d): '%s'", + atoi(ch), ch + 4), DEBUG); +// *ch2 = '<'; // needed? --yaz + } return -1; }