summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Williams <andy@andywilliams.me>2017-10-22 19:57:50 +0100
committerAndy Williams <andy@andywilliams.me>2017-10-22 19:57:50 +0100
commit0d836cc640c11371cc9841ad1d38ddd8b8c7b49a (patch)
treed34b319691fc62e19570293a6c0da8df43aa0b65
parente5cf2632530b52785a735dfbd87e04e7ec062cbc (diff)
Fix safety / actually checking full app IDs
-rw-r--r--src/lib/efler_config.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/lib/efler_config.c b/src/lib/efler_config.c
index a40273c..f20f66e 100644
--- a/src/lib/efler_config.c
+++ b/src/lib/efler_config.c
@@ -280,7 +280,8 @@ _efler_config_app_remove(const char *id)
280 280
281 EINA_LIST_FOREACH_SAFE(_efler_config->apps, list, next, app) 281 EINA_LIST_FOREACH_SAFE(_efler_config->apps, list, next, app)
282 { 282 {
283 if (!strncmp(app->id, id, strlen(app->id))) 283 if (strlen(app->id) == strlen(id) &&
284 !strncmp(app->id, id, strlen(app->id)))
284 break; 285 break;
285 } 286 }
286 287
@@ -300,7 +301,8 @@ _efler_config_app_installed_get(Efler_App *app)
300 301
301 EINA_LIST_FOREACH(_efler_config->apps, list, item) 302 EINA_LIST_FOREACH(_efler_config->apps, list, item)
302 { 303 {
303 if (!strncmp(item->id, app->id, strlen(item->id))) 304 if (strlen(item->id) == strlen(app->id) &&
305 !strncmp(item->id, app->id, strlen(item->id)))
304 return EINA_TRUE; 306 return EINA_TRUE;
305 } 307 }
306 308
@@ -315,7 +317,8 @@ _efler_config_app_installed_version_get(Efler_App *app)
315 317
316 EINA_LIST_FOREACH(_efler_config->apps, list, item) 318 EINA_LIST_FOREACH(_efler_config->apps, list, item)
317 { 319 {
318 if (!strncmp(item->id, app->id, strlen(item->id))) 320 if (strlen(item->id) == strlen(app->id) &&
321 !strncmp(item->id, app->id, strlen(item->id)))
319 return item->version; 322 return item->version;
320 } 323 }
321 324
@@ -333,10 +336,11 @@ _efler_config_app_installed_version_set(Efler_App *app)
333 336
334 EINA_LIST_FOREACH(_efler_config->apps, list, item) 337 EINA_LIST_FOREACH(_efler_config->apps, list, item)
335 { 338 {
336 if (strncmp(item->id, app->id, strlen(item->id))) 339 if (strlen(item->id) != strlen(app->id) ||
340 strncmp(item->id, app->id, strlen(item->id)))
337 continue; 341 continue;
338 342
339 item->version = app->version; 343 item->version = eina_stringshare_add(app->version);
340 break; 344 break;
341 } 345 }
342 346