embryo: Fix a potential buffer overflow (klocwork id 321)

Signed-off-by: Daniel Willmann <d.willmann@samsung.com>
This commit is contained in:
Daniel Willmann 2013-08-12 18:30:24 +01:00
parent d84e77d93f
commit 3e5bd813d3
1 changed files with 9 additions and 4 deletions

View File

@ -679,10 +679,15 @@ setconfig(char *root)
{
strcat(path, "include");
}
len = strlen(path);
path[len] = DIRSEP_CHAR;
path[len + 1] = '\0';
insert_path(path);
/* Make sure we have enough space for the trailing DIRSEP_CHAR */
if (strlen(path) == sizeof(path) - 1)
{
len = strlen(path);
path[len] = DIRSEP_CHAR;
path[len + 1] = '\0';
insert_path(path);
}
} /* if */
}