summaryrefslogtreecommitdiff
path: root/src/lib/efreet
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2016-01-25 11:20:55 -0500
committerMike Blumenkrantz <zmike@osg.samsung.com>2016-01-25 11:27:01 -0500
commit9aee7c249a8ef237dbc617474c0e45dea8a42475 (patch)
treec1f3e4f630993d10bfeae12dd68490567c6886b4 /src/lib/efreet
parent3d9a6e238af3837e273248c71da4d96daef10352 (diff)
efreet: reject invalid "" data for Efreet_Desktop->x hash
ref T3096 @fix
Diffstat (limited to 'src/lib/efreet')
-rw-r--r--src/lib/efreet/efreet_desktop.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/lib/efreet/efreet_desktop.c b/src/lib/efreet/efreet_desktop.c
index a49a975776..f3cef0c98a 100644
--- a/src/lib/efreet/efreet_desktop.c
+++ b/src/lib/efreet/efreet_desktop.c
@@ -515,6 +515,7 @@ efreet_desktop_x_field_set(Efreet_Desktop *desktop, const char *key, const char
515{ 515{
516 EINA_SAFETY_ON_NULL_RETURN_VAL(desktop, EINA_FALSE); 516 EINA_SAFETY_ON_NULL_RETURN_VAL(desktop, EINA_FALSE);
517 EINA_SAFETY_ON_TRUE_RETURN_VAL(strncmp(key, "X-", 2), EINA_FALSE); 517 EINA_SAFETY_ON_TRUE_RETURN_VAL(strncmp(key, "X-", 2), EINA_FALSE);
518 EINA_SAFETY_ON_TRUE_RETURN_VAL(data && (!data[0]), EINA_FALSE);
518 519
519 eina_lock_take(&_lock); 520 eina_lock_take(&_lock);
520 if (!desktop->x) 521 if (!desktop->x)
@@ -537,10 +538,15 @@ efreet_desktop_x_field_get(Efreet_Desktop *desktop, const char *key)
537 EINA_SAFETY_ON_TRUE_RETURN_VAL(strncmp(key, "X-", 2), NULL); 538 EINA_SAFETY_ON_TRUE_RETURN_VAL(strncmp(key, "X-", 2), NULL);
538 539
539 ret = eina_hash_find(desktop->x, key); 540 ret = eina_hash_find(desktop->x, key);
540 if (!ret) 541 ret = eina_stringshare_add(ret);
541 return NULL; 542 if (ret && (!ret[0]))
543 {
544 /* invalid null key somehow accepted; remove */
545 efreet_desktop_x_field_del(desktop, key);
546 eina_stringshare_replace(&ret, NULL);
547 }
542 548
543 return eina_stringshare_add(ret); 549 return ret;
544} 550}
545 551
546EAPI Eina_Bool 552EAPI Eina_Bool