changeset 4229:386c712a5b5b

imported a fix for memory overflow bug which has been proposed in mad-dev mailing list.
author Yoshiki Yazawa <yaz@cc.rim.or.jp>
date Thu, 31 Jan 2008 14:51:52 +0900
parents 9f3cc7f3aaf6
children 254ec9932b37
files src/libid3tag/field.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/libid3tag/field.c	Wed Jan 30 20:32:50 2008 +0300
+++ b/src/libid3tag/field.c	Thu Jan 31 14:51:52 2008 +0900
@@ -265,7 +265,7 @@
 
       end = *ptr + length;
 
-      while (end - *ptr > 0) {
+      while (end - *ptr > 0 && **ptr != '\0') {
 	latin1 = id3_parse_latin1(ptr, end - *ptr, 0);
 	if (latin1 == 0)
 	  goto fail;
@@ -304,7 +304,7 @@
 
       end = *ptr + length;
 
-      while (end - *ptr > 0) {
+      while (end - *ptr > 0 && **ptr != '\0') {
 	ucs4 = id3_parse_string(ptr, end - *ptr, *encoding, 0);
 	if (ucs4 == 0)
 	  goto fail;