Fix memory overflow issue about strncat
If src contains n or more bytes, strncat() writes n+1 bytes to dest (n from src plus the terminating null byte). Therefore, the size of dest must be at least strlen(dest)+n+1. * config/tc-tic4x.c (md_assemble): Correct strncat size.
This commit is contained in:
parent
45229ecbba
commit
450ccef08d
2 changed files with 5 additions and 1 deletions
|
@ -1,3 +1,7 @@
|
|||
2014-10-15 Chen Gang <gang.chen.5i5j@gmail.com>
|
||||
|
||||
* config/tc-tic4x.c (md_assemble): Correct strncat size.
|
||||
|
||||
2014-10-14 Tristan Gingold <gingold@adacore.com>
|
||||
|
||||
* NEWS: Add marker for 2.25.
|
||||
|
|
|
@ -2456,7 +2456,7 @@ md_assemble (char *str)
|
|||
if (*s) /* Null terminate for hash_find. */
|
||||
*s++ = '\0'; /* and skip past null. */
|
||||
strcat (insn->name, "_");
|
||||
strncat (insn->name, str, TIC4X_NAME_MAX - strlen (insn->name));
|
||||
strncat (insn->name, str, TIC4X_NAME_MAX - 1 - strlen (insn->name));
|
||||
|
||||
insn->operands[insn->num_operands++].mode = M_PARALLEL;
|
||||
|
||||
|
|
Loading…
Reference in a new issue