mirror of
https://github.com/thorvg/thorvg.git
synced 2025-07-28 09:05:52 +00:00
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:
parent
1e02d62d01
commit
f13e1947ff
1 changed files with 1 additions and 1 deletions
|
@ -2075,7 +2075,7 @@ static void _svgLoaderParserXmlOpen(SvgLoaderData* loader, const char* content,
|
||||||
sz = attrs - content;
|
sz = attrs - content;
|
||||||
attrsLength = length - sz;
|
attrsLength = length - sz;
|
||||||
while ((sz > 0) && (isspace(content[sz - 1]))) 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);
|
strncpy(tagName, content, sz);
|
||||||
tagName[sz] = '\0';
|
tagName[sz] = '\0';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue