embryo_cc - fix possible buffer overrun

fix CID 1039589
This commit is contained in:
Carsten Haitzler 2014-09-01 19:03:16 +09:00
parent 1f5aa3050b
commit 09648f6cf1
1 changed files with 2 additions and 1 deletions

View File

@ -3030,7 +3030,8 @@ insert_constval(constvalue * prev, constvalue * next, char *name,
if (!(cur = (constvalue *)malloc(sizeof(constvalue))))
error(103); /* insufficient memory (fatal error) */
memset(cur, 0, sizeof(constvalue));
strcpy(cur->name, name);
strncpy(cur->name, name, sizeof(cur->name) - 1);
cur->name[sizeof(cur->name) - 1] = 0;
cur->value = val;
cur->index = idx;
cur->next = next;