discomfitor pushed a commit to branch master.

commit 85022b2e40338846f9b8af4e0fe5d06c76208ffb
Author: Mike Blumenkrantz <[email protected]>
Date:   Fri Apr 26 10:37:54 2013 +0100

    fix dnd text-url/list handler to add trailing null before parsing into list
---
 src/bin/e_dnd.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/bin/e_dnd.c b/src/bin/e_dnd.c
index aec67a0..c7b45a5 100644
--- a/src/bin/e_dnd.c
+++ b/src/bin/e_dnd.c
@@ -509,14 +509,6 @@ e_dnd_util_text_uri_list_convert(char *data, int size)
    int i, is;
    Eina_List *ret = NULL;
 
-   if (data && data[size - 1])
-     {
-        /* Isn't nul terminated */
-        size++;
-        data = realloc(data, size);
-        data[size - 1] = 0;
-     }
-
    tmp = malloc(size);
    is = i = 0;
    while ((is < size) && (data[is]))
@@ -981,6 +973,18 @@ _e_drag_end(int x, int y)
                   for (i = 0; i < _drag_current->num_types; i++)
                     if (_drag_current->types[i] == _type_text_uri_list)
                       {
+                         char *data = _drag_current->data;
+                         int size = _drag_current->data_size;
+
+                         if (data && data[size - 1])
+                           {
+                              /* Isn't nul terminated */
+                              size++;
+                              data = realloc(data, size);
+                              data[size - 1] = 0;
+                           }
+                         _drag_current->data = data;
+                         _drag_current->data_size = size;
                          ev.data = 
e_dnd_util_text_uri_list_convert(_drag_current->data, _drag_current->data_size);
                          need_free = EINA_TRUE;
                          break;

-- 

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr

Reply via email to