svg_loader SvgLoader: Prevent array overflow

Since tagName array set '\0' at the end,
it may overflow when sz reaches 20.
So make it a maximum of 19.
This commit is contained in:
JunsuChoi 2020-12-18 11:05:22 +09:00 committed by Hermet Park
parent 1e02d62d01
commit f13e1947ff

View file

@ -2075,7 +2075,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 ((unsigned int)sz >= sizeof(tagName)) return;
strncpy(tagName, content, sz);
tagName[sz] = '\0';
}