From dd0bd7bce37ec399757668d36c0d57b30c00fa8a Mon Sep 17 00:00:00 2001 From: Hannes Janetzek Date: Thu, 10 Mar 2011 01:18:03 +0000 Subject: [PATCH] e17/evry-apps: fix: check string length before strncpy to not be negative SVN revision: 57645 --- src/modules/everything-apps/e_mod_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/modules/everything-apps/e_mod_main.c b/src/modules/everything-apps/e_mod_main.c index b9b775f38..b4482bb78 100644 --- a/src/modules/everything-apps/e_mod_main.c +++ b/src/modules/everything-apps/e_mod_main.c @@ -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