devilhorns pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=48eb02422251066f68f01bc2c68f5acc59f3535c

commit 48eb02422251066f68f01bc2c68f5acc59f3535c
Author: Mike Blumenkrantz <zm...@samsung.com>
Date:   Tue Jul 3 12:39:36 2018 -0400

    elm_test: fix invalid read in dnd image drop
    
    Summary:
    this selection is data with a specified length, not a terminated string
    
    @fix
    Depends on D6484
    
    Reviewers: devilhorns
    
    Subscribers: netstar, cedric, #committers
    
    Tags: #efl
    
    Differential Revision: https://phab.enlightenment.org/D6485
---
 src/bin/elementary/test_dnd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/bin/elementary/test_dnd.c b/src/bin/elementary/test_dnd.c
index 3b44c2bd40..2e5aab507f 100644
--- a/src/bin/elementary/test_dnd.c
+++ b/src/bin/elementary/test_dnd.c
@@ -1216,10 +1216,12 @@ _label_drop_cb(void *data EINA_UNUSED, Evas_Object 
*obj, Elm_Selection_Data *ev)
 static Eina_Bool
 _image_drop_cb(void *data EINA_UNUSED, Evas_Object *obj, Elm_Selection_Data 
*ev)
 {
-   const char *f = ev->data;
+   char *f = (char*)eina_memdup(ev->data, ev->len, 1);
+
    printf("%s: obj: %s %p drop data: %s\n", __func__,
           evas_object_type_get(obj), obj, f);
    elm_image_file_set(obj, f, NULL);
+   free(f);
    return EINA_TRUE;
 }
 

-- 


Reply via email to