forked from enlightenment/efl
fix path string stuff to not be able to overflow (unlikely tho - ever)
SVN revision: 33571
This commit is contained in:
parent
28a9a00d43
commit
7bc642aff1
|
@ -697,7 +697,11 @@ setconfig(char *root)
|
||||||
|
|
||||||
/* add the default "include" directory */
|
/* add the default "include" directory */
|
||||||
if (root != NULL)
|
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 : */
|
/* terminate just behind last \ or : */
|
||||||
if ((ptr = strrchr(path, DIRSEP_CHAR)) != NULL
|
if ((ptr = strrchr(path, DIRSEP_CHAR)) != NULL
|
||||||
|| (ptr = strchr(path, ':')) != NULL)
|
|| (ptr = strchr(path, ':')) != NULL)
|
||||||
|
@ -708,7 +712,10 @@ setconfig(char *root)
|
||||||
* to the list in that case
|
* to the list in that case
|
||||||
*/
|
*/
|
||||||
*(ptr + 1) = '\0';
|
*(ptr + 1) = '\0';
|
||||||
strcat(path, "include");
|
if (strlen(path) < (sizeof(path) - 1 - 7))
|
||||||
|
{
|
||||||
|
strcat(path, "include");
|
||||||
|
}
|
||||||
len = strlen(path);
|
len = strlen(path);
|
||||||
path[len] = DIRSEP_CHAR;
|
path[len] = DIRSEP_CHAR;
|
||||||
path[len + 1] = '\0';
|
path[len + 1] = '\0';
|
||||||
|
|
Loading…
Reference in New Issue