Client: fix potential out of bounds read.

This is an unsigned int underflow that could lead to an out
of bounds read.

CID 1291837

@fix
This commit is contained in:
Tom Hacohen 2015-10-09 09:19:51 +01:00
parent fe1eabe4ad
commit 981e3f8f31
1 changed files with 4 additions and 1 deletions

View File

@ -3257,7 +3257,10 @@ e_client_below_get(const E_Client *ec)
if (e_comp_canvas_client_layer_map(ec->layer) == 9999) return NULL;
/* go down the layers until we find one */
for (x = e_comp_canvas_layer_map(ec->layer) - 1; x >= e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); x--)
x = e_comp_canvas_layer_map(ec->layer);
if (x > 0) x--;
for (; x >= e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); x--)
{
if (!e_comp->layers[x].clients) continue;
EINA_INLIST_REVERSE_FOREACH(e_comp->layers[x].clients, ec2)