From: bcoudurier Date: Sun, 24 May 2009 10:26:41 +0000 (+0000) Subject: fix get_str16_nolen with odd len, fix #1065 X-Git-Url: https://rtime.felk.cvut.cz/gitweb/frescor/ffmpeg.git/commitdiff_plain/898f489341cad546684cae31dd32dea18b03d21d fix get_str16_nolen with odd len, fix #1065 git-svn-id: file:///var/local/repositories/ffmpeg/trunk@18929 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b --- diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index e89c0e49a..f8223df2f 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -122,11 +122,12 @@ static void get_str16(ByteIOContext *pb, char *buf, int buf_size) static void get_str16_nolen(ByteIOContext *pb, int len, char *buf, int buf_size) { char* q = buf; - len /= 2; - while (len--) { + for (; len > 1; len -= 2) { uint8_t tmp; PUT_UTF8(get_le16(pb), tmp, if (q - buf < buf_size - 1) *q++ = tmp;) } + if (len > 0) + url_fskip(pb, len); *q = '\0'; }