From: kramm Date: Wed, 17 Jan 2007 13:33:28 +0000 (+0000) Subject: made getstring respect the tag boundary X-Git-Tag: release-0-8-0~40 X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=commitdiff_plain;h=f3784f411338b99aa3b04c5e881c995227c8a053 made getstring respect the tag boundary --- diff --git a/lib/rfxswf.c b/lib/rfxswf.c index b986c83..ad3ad21 100644 --- a/lib/rfxswf.c +++ b/lib/rfxswf.c @@ -83,7 +83,16 @@ void swf_SetTagPos(TAG * t,U32 pos) char* swf_GetString(TAG*t) { char* str = ((char*)(&(t)->data[(t)->pos])); - while(swf_GetU8(t)); + while(t->pos < t->len && swf_GetU8(t)); + /* make sure we always have a trailing zero byte */ + if(t->pos == t->len) { + if(t->len == t->memsize) { + swf_ResetWriteBits(t); + swf_SetU8(t, 0); + t->len = t->pos; + } + t->data[t->len] = 0; + } return str; }