1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

fix get_str16_nolen with odd len, fix #1065

Originally committed as revision 18929 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Baptiste Coudurier 2009-05-24 10:26:41 +00:00
parent c9d7cd6dca
commit 46b4019bfa

View File

@ -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) static void get_str16_nolen(ByteIOContext *pb, int len, char *buf, int buf_size)
{ {
char* q = buf; char* q = buf;
len /= 2; for (; len > 1; len -= 2) {
while (len--) {
uint8_t tmp; uint8_t tmp;
PUT_UTF8(get_le16(pb), tmp, if (q - buf < buf_size - 1) *q++ = tmp;) PUT_UTF8(get_le16(pb), tmp, if (q - buf < buf_size - 1) *q++ = tmp;)
} }
if (len > 0)
url_fskip(pb, len);
*q = '\0'; *q = '\0';
} }