e17/evry-apps: fix: check string length before strncpy to not be negative

SVN revision: 57645
This commit is contained in:
Hannes Janetzek 2011-03-10 01:18:03 +00:00
parent 1925cec0c6
commit dd0bd7bce3
1 changed files with 4 additions and 2 deletions

View File

@ -420,11 +420,13 @@ _desktop_list_add(Plugin *p, Eina_List *apps, const char *input)
if (input)
{
/* strip path and parameter */
exec = ecore_file_file_get(desktop->exec);
if (exec && (end = strchr(exec, '%')))
if ((exec) && (end = strchr(exec, '%')) &&
((end - exec) - 1 > 0))
{
strncpy(buf, exec, (end - exec) - 1);
buf[(end - exec)-1] = '\0';
buf[(end - exec) - 1] = '\0';
m1 = evry->fuzzy_match(buf, input);
}
else