changeset 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 e23b8e1472e3
children 9794a5487524
files ChangeLog src/scrobbler/gerpok.c src/scrobbler/hatena.c src/scrobbler/scrobbler.c
diffstat 4 files changed, 32 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Mar 06 04:44:26 2007 -0800
+++ b/ChangeLog	Tue Mar 06 05:17:29 2007 -0800
@@ -1,3 +1,11 @@
+2007-03-06 12:44:26 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
+  revision [1668]
+  - don't use a vfs buffered source for local files
+  
+  trunk/src/aac/src/libmp4.c |    6 +++++-
+  1 file changed, 5 insertions(+), 1 deletion(-)
+
+
 2007-03-06 09:12:16 +0000  Yoshiki Yazawa <yaz@cc.rim.or.jp>
   revision [1666]
   - fix read_replaygain(). necessary fseek was missing in reuse fd code. closes #843.
--- 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;
 	}
--- a/src/scrobbler/hatena.c	Tue Mar 06 04:44:26 2007 -0800
+++ b/src/scrobbler/hatena.c	Tue Mar 06 05:17:29 2007 -0800
@@ -506,13 +506,16 @@
 	}
 
 	if (!strncmp(hatena_sc_srv_res, "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">", 50)) {
-		ch = strstr(hatena_sc_srv_res, "<TITLE>") + 7;
+		ch = strstr(hatena_sc_srv_res, "<TITLE>");
 		ch2 = strstr(hatena_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;
 	}
--- a/src/scrobbler/scrobbler.c	Tue Mar 06 04:44:26 2007 -0800
+++ b/src/scrobbler/scrobbler.c	Tue Mar 06 05:17:29 2007 -0800
@@ -543,13 +543,16 @@
 	}
 
 	if (!strncmp(sc_srv_res, "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">", 50)) {
-		ch = strstr(sc_srv_res, "<TITLE>") + 7;
+		ch = strstr(sc_srv_res, "<TITLE>");
 		ch2 = strstr(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;
 	}