diff --git a/legacy/embryo/src/bin/embryo_cc_sc1.c b/legacy/embryo/src/bin/embryo_cc_sc1.c index 1f2073cbc8..0e3949257b 100644 --- a/legacy/embryo/src/bin/embryo_cc_sc1.c +++ b/legacy/embryo/src/bin/embryo_cc_sc1.c @@ -697,7 +697,11 @@ setconfig(char *root) /* add the default "include" directory */ if (root != NULL) - strcpy(path, root); /* path + filename (hopefully) */ + { + /* path + filename (hopefully) */ + strncpy(path, root, sizeof(path) - 1); + path[sizeof(path) - 1] = 0; + } /* terminate just behind last \ or : */ if ((ptr = strrchr(path, DIRSEP_CHAR)) != NULL || (ptr = strchr(path, ':')) != NULL) @@ -708,7 +712,10 @@ setconfig(char *root) * to the list in that case */ *(ptr + 1) = '\0'; - strcat(path, "include"); + if (strlen(path) < (sizeof(path) - 1 - 7)) + { + strcat(path, "include"); + } len = strlen(path); path[len] = DIRSEP_CHAR; path[len + 1] = '\0';