fix seb "fix" commit that causes lots of segvs.

this fixes 04e0a6d95e which introduced
copy & paste segv's by properly terminating the right buffer.
This commit is contained in:
Carsten Haitzler 2013-12-09 18:39:07 +09:00
parent b10dcb5c23
commit 82841fefe3
2 changed files with 6 additions and 8 deletions

File diff suppressed because one or more lines are too long

View File

@ -599,13 +599,11 @@ ecore_x_selection_converter_text(char *target,
&text_prop) == Success)
{
int bufsize = strlen((char *)text_prop.value);
*data_ret = malloc(bufsize + 1);
if (!*data_ret)
{
return EINA_FALSE;
}
memcpy(*data_ret, text_prop.value, bufsize);
((char **)data_ret)[bufsize] = 0;
char *s = malloc(bufsize + 1);
if (!s) return EINA_FALSE;
*data_ret = s;
memcpy(s, text_prop.value, bufsize);
s[bufsize] = 0;
*size_ret = bufsize;
XFree(text_prop.value);
return EINA_TRUE;