# HG changeset patch # User diego # Date 1253729080 0 # Node ID 4a01407f678dce1b660040706d9eb7c3b3d1a7cf # Parent a59767d339288f4e3bb1b4d0e5fb856b5bc65efc id3v2: check for enough space to write full UTF-8 characters. patch by Anton Khirnov, wyskas gmail com diff -r a59767d33928 -r 4a01407f678d id3v2.c --- 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;