efl selection manager - fix anoyther binary buffer treated as string bug

yet another "binary buffer" (pointer + size) streated as a string with
strdup + strlen which is oh so wrong. this fixes up some cnp in
wayland with garbage at the end of strings

@fix
This commit is contained in:
Carsten Haitzler 2018-04-12 23:59:03 +09:00
parent 59f3dbdd34
commit 9d6ac24a9c
1 changed files with 8 additions and 3 deletions

View File

@ -2384,10 +2384,15 @@ _wl_general_converter(char *target, Sel_Manager_Selection *sel, void *data, int
}
else
{
if (data)
if ((data) && (size > 0))
{
if (data_ret) *data_ret = strdup(data);
if (size_ret) *size_ret = strlen(data);
char *tmp = malloc(size);
if (tmp)
{
memcpy(tmp, data, size);
if (data_ret) *data_ret = tmp;
if (size_ret) *size_ret = size;
}
}
else
{