From: Cedric BAIL Date: Thu, 16 Jun 2011 09:16:03 +0000 (+0000) Subject: ecore: fix ecore_x_selection_convert not taking selection length into account. X-Git-Tag: submit/devel/efl/20131022.203902~9229 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b414ea97fbfb94ee61bdf7d161a13cd2027f7038;p=platform%2Fupstream%2Fefl.git ecore: fix ecore_x_selection_convert not taking selection length into account. SVN revision: 60382 --- diff --git a/legacy/ecore/ChangeLog b/legacy/ecore/ChangeLog index 5e2fb47..d31525a 100644 --- a/legacy/ecore/ChangeLog +++ b/legacy/ecore/ChangeLog @@ -220,3 +220,7 @@ * Add ecore_con_ssl_client/server_upgrade to begin asynchronously upgrading an existing connection to SSL/TLS, emitting ECORE_CON_CLIENT/SERVER_UPGRADE event upon completion. + +2011-06-16 Cedric Bail + + * Fix ecore_x_selection_convert not taking selection length into account. diff --git a/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_selection.c b/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_selection.c index aeb30d3..5d7f417 100644 --- a/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_selection.c +++ b/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_selection.c @@ -600,8 +600,10 @@ _ecore_x_selection_converter_text(char *target, #endif /* ifdef X_HAVE_UTF8_STRING */ else return EINA_FALSE; - if (!(mystr = strdup(data))) - return EINA_FALSE; + + mystr = alloca(size + 1); + memcpy(mystr, data, size); + mystr[size] = '\0'; #ifdef X_HAVE_UTF8_STRING if (Xutf8TextListToTextProperty(_ecore_x_disp, &mystr, 1, style, @@ -611,13 +613,11 @@ _ecore_x_selection_converter_text(char *target, *data_ret = malloc(bufsize); if (!*data_ret) { - free(mystr); return EINA_FALSE; } memcpy(*data_ret, text_prop.value, bufsize); *size_ret = bufsize; XFree(text_prop.value); - free(mystr); return EINA_TRUE; } @@ -631,14 +631,12 @@ _ecore_x_selection_converter_text(char *target, memcpy(*data_ret, text_prop.value, bufsize); *size_ret = bufsize; XFree(text_prop.value); - free(mystr); return EINA_TRUE; } #endif /* ifdef X_HAVE_UTF8_STRING */ else { - free(mystr); return EINA_TRUE; } } /* _ecore_x_selection_converter_text */