svg_loader: fixed wrong boundary check

sz must be less than 20 to append 'carriage return'
This commit is contained in:
Hermet Park 2020-12-22 11:03:13 +09:00
parent 59ffa16b32
commit e737ee4a4f

View file

@ -2124,7 +2124,7 @@ static void _svgLoaderParserXmlOpen(SvgLoaderData* loader, const char* content,
sz = attrs - content;
attrsLength = length - sz;
while ((sz > 0) && (isspace(content[sz - 1]))) sz--;
if ((unsigned int)sz >= sizeof(tagName)) return;
if ((uint)sz >= sizeof(tagName)) return;
strncpy(tagName, content, sz);
tagName[sz] = '\0';
}
@ -2486,7 +2486,7 @@ static bool _svgLoaderParserForValidCheckXmlOpen(SvgLoaderData* loader, const ch
sz = attrs - content;
attrsLength = length - sz;
while ((sz > 0) && (isspace(content[sz - 1]))) sz--;
if ((unsigned int)sz > sizeof(tagName)) return false;
if ((uint)sz >= sizeof(tagName)) return false;
strncpy(tagName, content, sz);
tagName[sz] = '\0';
}