vg_load_svg: Prevent memory overflow for tag_name

Summary:
When copying tag_name, if length of referenced string is longer
than general case, it is not used as tag_name.

Test Plan: N/A

Reviewers: Hermet, smohanty

Reviewed By: Hermet

Subscribers: kimcinoo, herb, cedric, #committers, #reviewers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D12185
This commit is contained in:
junsu choi 2020-11-02 13:05:44 +09:00 committed by Hermet Park
parent 94c2d2295f
commit 888e1e7401
1 changed files with 1 additions and 0 deletions

View File

@ -2279,6 +2279,7 @@ _evas_svg_loader_xml_open_parser(Evas_SVG_Loader *loader,
attrs_length = length - sz;
while ((sz > 0) && (isspace(content[sz - 1])))
sz--;
if ((unsigned int)sz > sizeof(tag_name)) return;
strncpy(tag_name, content, sz);
tag_name[sz] = '\0';
}