summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Zaoui <daniel.zaoui@samsung.com>2015-06-14 11:12:36 +0300
committerDaniel Zaoui <daniel.zaoui@samsung.com>2015-06-14 11:23:52 +0300
commitd451e9db710774e907f28f79480bfa239a052bfa (patch)
treed915e7a78e7a879d81ed320467c9d4e37705300f
parentc4df45cbf04dd9fd40cd50d0b789bf2e8c4ba157 (diff)
DnD/X11: Fix invalid access to memory
It seems X doesn't send the data with the termination.
-rw-r--r--src/lib/elm_cnp.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/lib/elm_cnp.c b/src/lib/elm_cnp.c
index d7619c16c..702ece9a7 100644
--- a/src/lib/elm_cnp.c
+++ b/src/lib/elm_cnp.c
@@ -1047,27 +1047,21 @@ _x11_data_preparer_uri(Ecore_X_Event_Selection_Notify *notify,
1047 else 1047 else
1048 { 1048 {
1049 Efreet_Uri *uri; 1049 Efreet_Uri *uri;
1050 int len = 0;
1051 1050
1052 p = (char *)data->data; 1051 p = (char *)eina_memdup((unsigned char *)data->data, data->length, EINA_TRUE);
1052 if (!p) return EINA_FALSE;
1053 uri = efreet_uri_decode(p); 1053 uri = efreet_uri_decode(p);
1054 if (!uri) 1054 if (!uri)
1055 { 1055 {
1056 /* Is there any reason why we care of URI without scheme? */ 1056 /* Is there any reason why we care of URI without scheme? */
1057 if (p[0] == '/') 1057 if (p[0] == '/') stripstr = p;
1058 len = data->length; 1058 else free(p);
1059 } 1059 }
1060 else 1060 else
1061 { 1061 {
1062 p = (char *)uri->path; 1062 free(p);
1063 len = strlen(p); 1063 stripstr = (char *)eina_memdup((unsigned char *)uri->path, strlen(uri->path), EINA_TRUE);
1064 }
1065 if (len > 0)
1066 {
1067 stripstr = malloc(len + 1);
1068 if (!stripstr) return EINA_FALSE; 1064 if (!stripstr) return EINA_FALSE;
1069 memcpy(stripstr, p, len);
1070 stripstr[len] = 0;
1071 } 1065 }
1072 } 1066 }
1073 1067