herdsman pushed a commit to branch master. http://git.enlightenment.org/core/elementary.git/commit/?id=4f7c682591815e5feafc6a8395533e82e357a02e
commit 4f7c682591815e5feafc6a8395533e82e357a02e Author: Daniel Hirt <[email protected]> Date: Sun Jan 4 13:54:03 2015 +0200 Elm_Entry: Fix dropped text data insertion Fixes bad drag&drop into entry widgets, since the drop callback assumed that the dropped text ends with a NULL character. How to reproduce: 1. Open 'elementary_test -to Entry' 2. Open some application (e.g. Firefox) 3. Select some (preferably short) text, and drag&drop it to the entry widget. This sometimes pastes additional corrupted text (better try with a 1-3 characters text). @fix --- src/lib/elm_entry.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/lib/elm_entry.c b/src/lib/elm_entry.c index 7582ff1..d398d03 100644 --- a/src/lib/elm_entry.c +++ b/src/lib/elm_entry.c @@ -616,6 +616,7 @@ _drag_drop_cb(void *data EINA_UNUSED, Elm_Selection_Data *drop) { Eina_Bool rv; + char *buf; ELM_ENTRY_DATA_GET(obj, sd); @@ -626,7 +627,16 @@ _drag_drop_cb(void *data EINA_UNUSED, if (!rv) WRN("Warning: Failed to position cursor: paste anyway"); - elm_entry_entry_insert(obj, drop->data); + buf = malloc(drop->len + 1); + if (!buf) + { + ERR("Failed to allocate memory for dropped text %p", obj); + return EINA_FALSE; + } + memcpy(buf, drop->data, drop->len); + buf[drop->len] = '\0'; + elm_entry_entry_insert(obj, buf); + free(buf); edje_object_part_text_cursor_copy (sd->entry_edje, "elm.text", EDJE_CURSOR_USER, /*->*/ EDJE_CURSOR_MAIN); --
