changeset 5229:4a01407f678d libavformat

id3v2: check for enough space to write full UTF-8 characters. patch by Anton Khirnov, wyskas gmail com
author diego
date Wed, 23 Sep 2009 18:04:40 +0000
parents a59767d33928
children 0d26775e9f47
files id3v2.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/id3v2.c	Wed Sep 23 09:18:23 2009 +0000
+++ b/id3v2.c	Wed Sep 23 18:04:40 2009 +0000
@@ -92,9 +92,9 @@
 
     case 0:  /* ISO-8859-1 (0 - 255 maps directly into unicode) */
         q = dst;
-        while (taglen--) {
+        while (taglen-- && q - dst < dstlen - 7) {
             uint8_t tmp;
-            PUT_UTF8(get_byte(s->pb), tmp, if (q - dst < dstlen - 1) *q++ = tmp;)
+            PUT_UTF8(get_byte(s->pb), tmp, *q++ = tmp;)
         }
         *q = '\0';
         break;