forked from enlightenment/enlightenment
e hints - fix beyond end of array fetch and segv
asan found this one. @fix
This commit is contained in:
parent
9ee7f38659
commit
67da43ee36
|
@ -681,7 +681,7 @@ e_hints_window_type_get(E_Client *ec)
|
||||||
(void)ec;
|
(void)ec;
|
||||||
#else
|
#else
|
||||||
Ecore_X_Window_Type *types = NULL;
|
Ecore_X_Window_Type *types = NULL;
|
||||||
int num, i, j;
|
int num, i, j, k;
|
||||||
|
|
||||||
if (!e_client_has_xwindow(ec)) return;
|
if (!e_client_has_xwindow(ec)) return;
|
||||||
num = ecore_x_netwm_window_types_get(e_client_util_win_get(ec), &types);
|
num = ecore_x_netwm_window_types_get(e_client_util_win_get(ec), &types);
|
||||||
|
@ -701,8 +701,8 @@ e_hints_window_type_get(E_Client *ec)
|
||||||
while ((j < num) &&
|
while ((j < num) &&
|
||||||
(ec->netwm.type == E_WINDOW_TYPE_UNKNOWN))
|
(ec->netwm.type == E_WINDOW_TYPE_UNKNOWN))
|
||||||
{
|
{
|
||||||
j++;
|
|
||||||
ec->netwm.type = types[j];
|
ec->netwm.type = types[j];
|
||||||
|
j++;
|
||||||
}
|
}
|
||||||
if (num > j)
|
if (num > j)
|
||||||
{
|
{
|
||||||
|
@ -710,8 +710,8 @@ e_hints_window_type_get(E_Client *ec)
|
||||||
malloc((num - j) * sizeof(Ecore_X_Window_Type));
|
malloc((num - j) * sizeof(Ecore_X_Window_Type));
|
||||||
if (ec->netwm.extra_types)
|
if (ec->netwm.extra_types)
|
||||||
{
|
{
|
||||||
for (i = j + 1; i < num; i++)
|
for (i = j, k = 0; i < num; i++, k++)
|
||||||
ec->netwm.extra_types[i - (j + 1)] = types[i];
|
ec->netwm.extra_types[k] = types[i];
|
||||||
ec->netwm.extra_types_num = num - j;
|
ec->netwm.extra_types_num = num - j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue