embryo_cc - fix possible buffer overrun

fix CID 1039590
This commit is contained in:
Carsten Haitzler 2014-09-01 19:05:50 +09:00
parent 09648f6cf1
commit 88fda07299
1 changed files with 4 additions and 2 deletions

View File

@ -3803,12 +3803,14 @@ doswitch(void)
if (swdefault == FALSE)
{
/* store lbl_exit as the "none-matched" label in the switch table */
strcpy(labelname, itoh(lbl_exit));
strncpy(labelname, itoh(lbl_exit), sizeof(labelname) - 1);
labelname[sizeof(labelname) - 1] = 0;
}
else
{
/* lbl_case holds the label of the "default" clause */
strcpy(labelname, itoh(lbl_case));
strncpy(labelname, itoh(lbl_case), sizeof(labelname) - 1);
labelname[sizeof(labelname) - 1] = 0;
} /* if */
ffcase(casecount, labelname, TRUE);
/* generate the rest of the table */