embryo_cc - fix possible buffer overrun

fix CID 1039594
This commit is contained in:
Carsten Haitzler 2014-09-01 19:15:46 +09:00
parent d78703d0a8
commit 0b7e3cf422
1 changed files with 2 additions and 1 deletions

View File

@ -1560,7 +1560,8 @@ decl_const(int vclass)
if (lex(&val, &str) != tSYMBOL) /* read in (new) token */
error(20, str); /* invalid symbol name */
symbolline = fline; /* save line where symbol was found */
strcpy(constname, str); /* save symbol name */
strncpy(constname, str, sizeof(constname) - 1); /* save symbol name */
constname[sizeof(constname) - 1] = 0;
needtoken('=');
constexpr(&val, &exprtag); /* get value */
needtoken(tTERM);