summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric Bail <cedric.bail@samsung.com>2013-06-27 12:25:03 +0900
committerCedric Bail <cedric.bail@samsung.com>2013-06-27 15:19:44 +0900
commit267b9e4c293976d3966c75f448f85cee5f4be1b2 (patch)
treee5c858f5cd6cce0073e20ff898f167cf8cf7dcf1
parent61396654a5b477405ab473d11f6b9d8a9d95219e (diff)
efreet: always sanitize path.
-rw-r--r--src/lib/efreet/efreet_icon.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/lib/efreet/efreet_icon.c b/src/lib/efreet/efreet_icon.c
index 229c752f38..b121ae626e 100644
--- a/src/lib/efreet/efreet_icon.c
+++ b/src/lib/efreet/efreet_icon.c
@@ -99,7 +99,9 @@ efreet_icon_deprecated_user_dir_get(void)
99 tmp = alloca(len); 99 tmp = alloca(len);
100 snprintf(tmp, len, "%s/.icons", user); 100 snprintf(tmp, len, "%s/.icons", user);
101 101
102 tmp = eina_file_path_sanitize(tmp);
102 efreet_icon_deprecated_user_dir = eina_stringshare_add_length(tmp, len - 1); 103 efreet_icon_deprecated_user_dir = eina_stringshare_add_length(tmp, len - 1);
104 free(tmp);
103 105
104 return efreet_icon_deprecated_user_dir; 106 return efreet_icon_deprecated_user_dir;
105} 107}
@@ -118,7 +120,9 @@ efreet_icon_user_dir_get(void)
118 tmp = alloca(len); 120 tmp = alloca(len);
119 snprintf(tmp, len, "%s/icons", user); 121 snprintf(tmp, len, "%s/icons", user);
120 122
123 tmp = eina_file_path_sanitize(tmp);
121 efreet_icon_user_dir = eina_stringshare_add_length(tmp, len - 1); 124 efreet_icon_user_dir = eina_stringshare_add_length(tmp, len - 1);
125 free(tmp);
122 126
123 return efreet_icon_user_dir; 127 return efreet_icon_user_dir;
124} 128}
@@ -682,9 +686,11 @@ efreet_icon_lookup_path_path(Efreet_Cache_Icon_Element *elem, const char *path)
682{ 686{
683 Eina_List *ll; 687 Eina_List *ll;
684 const char *ext, *pp; 688 const char *ext, *pp;
689 const char *r = NULL;
685 unsigned int i; 690 unsigned int i;
686 int len; 691 int len;
687 692
693 path = eina_file_path_sanitize(path);
688 len = strlen(path); 694 len = strlen(path);
689 695
690 for (i = 0; i < elem->paths_count; ++i) 696 for (i = 0; i < elem->paths_count; ++i)
@@ -695,10 +701,15 @@ efreet_icon_lookup_path_path(Efreet_Cache_Icon_Element *elem, const char *path)
695 701
696 EINA_LIST_FOREACH(efreet_icon_extensions, ll, ext) 702 EINA_LIST_FOREACH(efreet_icon_extensions, ll, ext)
697 if (!strcmp(pp, ext)) 703 if (!strcmp(pp, ext))
698 return elem->paths[i]; 704 {
705 r = elem->paths[i];
706 break;
707 }
699 } 708 }
700 709
701 return NULL; 710 free((void*) path);
711
712 return r;
702} 713}
703 714
704static const char * 715static const char *
@@ -767,9 +778,11 @@ efreet_icon_fallback_lookup_path_path(Efreet_Cache_Fallback_Icon *icon, const ch
767{ 778{
768 Eina_List *ll; 779 Eina_List *ll;
769 const char *ext, *pp; 780 const char *ext, *pp;
781 const char *r = NULL;
770 unsigned int i; 782 unsigned int i;
771 int len; 783 int len;
772 784
785 path = eina_file_path_sanitize(path);
773 len = strlen(path); 786 len = strlen(path);
774 787
775 for (i = 0; i < icon->icons_count; ++i) 788 for (i = 0; i < icon->icons_count; ++i)
@@ -781,10 +794,15 @@ efreet_icon_fallback_lookup_path_path(Efreet_Cache_Fallback_Icon *icon, const ch
781 794
782 EINA_LIST_FOREACH(efreet_icon_extensions, ll, ext) 795 EINA_LIST_FOREACH(efreet_icon_extensions, ll, ext)
783 if (!strcmp(pp, ext)) 796 if (!strcmp(pp, ext))
784 return icon->icons[i]; 797 {
798 r = icon->icons[i];
799 break;
800 }
785 } 801 }
786 802
787 return NULL; 803 free((void*) path);
804
805 return r;
788} 806}
789 807
790static void 808static void