- strncpy(str, argv[i], sizeof(str));
+ strncpy(str, argv[i], sizeof(str) -1);
+ str[sizeof(str) - 1] = '\0';
if (lex(&val, &str) != tSYMBOL) /* read in (new) token */
error(20, str); /* invalid symbol name */
symbolline = fline; /* save line where symbol was found */
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;
* tag was set) */
if (lex(&val, &str) == tSYMBOL)
{ /* read in (new) token */
* tag was set) */
if (lex(&val, &str) == tSYMBOL)
{ /* read in (new) token */
- strcpy(enumname, str); /* save enum name (last constant) */
+ strncpy(enumname, str, sizeof(enumname) - 1); /* save enum name (last constant) */
+ enumname[sizeof(enumname) - 1] = 0;
tok = lex(&val, &str); /* read in (new) token */
if (tok != tSYMBOL && tok != tLABEL)
error(20, str); /* invalid symbol name */
tok = lex(&val, &str); /* read in (new) token */
if (tok != tSYMBOL && tok != tLABEL)
error(20, str); /* invalid symbol name */
- strcpy(constname, str); /* save symbol name */
+ strncpy(constname, str, sNAMEMAX); /* save symbol name */
+ constname[sNAMEMAX] = 0;
size = increment; /* default increment of 'val' */
if (tok == tLABEL || matchtoken(':'))
constexpr(&size, NULL); /* get size */
size = increment; /* default increment of 'val' */
if (tok == tLABEL || matchtoken(':'))
constexpr(&size, NULL); /* get size */
- strcpy(name, ptr); /* save symbol name */
+ strncpy(name, ptr, sizeof(name) - 1); /* save symbol name */
+ name[sizeof(name) - 1] = 0;
if (name[0] == PUBLIC_CHAR)
error(56, name); /* function arguments cannot be public */
if (numtags == 0)
if (name[0] == PUBLIC_CHAR)
error(56, name); /* function arguments cannot be public */
if (numtags == 0)
- strcpy(arg->name, name);
+ strncpy(arg->name, name, sizeof(arg->name) - 1);
+ arg->name[sizeof(arg->name) - 1] = 0;
if (!(cur = (constvalue *)malloc(sizeof(constvalue))))
error(103); /* insufficient memory (fatal error) */
memset(cur, 0, sizeof(constvalue));
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;
- strcpy(labelname, itoh(lbl_exit));
+ strncpy(labelname, itoh(lbl_exit), sizeof(labelname) - 1);
+ labelname[sizeof(labelname) - 1] = 0;
- 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 */
} /* if */
ffcase(casecount, labelname, TRUE);
/* generate the rest of the table */