raster pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=67da43ee363449b93676f8708ecfb1477bff0d8d

commit 67da43ee363449b93676f8708ecfb1477bff0d8d
Author: Carsten Haitzler (Rasterman) <[email protected]>
Date:   Sat Aug 10 13:34:32 2019 +0100

    e hints - fix beyond end of array fetch and segv
    
    asan found this one.
    
    @fix
---
 src/bin/e_hints.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/bin/e_hints.c b/src/bin/e_hints.c
index c5f842772..f1b8f6125 100644
--- a/src/bin/e_hints.c
+++ b/src/bin/e_hints.c
@@ -681,7 +681,7 @@ e_hints_window_type_get(E_Client *ec)
    (void)ec;
 #else
    Ecore_X_Window_Type *types = NULL;
-   int num, i, j;
+   int num, i, j, k;
 
    if (!e_client_has_xwindow(ec)) return;
    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) &&
                (ec->netwm.type == E_WINDOW_TYPE_UNKNOWN))
           {
-             j++;
              ec->netwm.type = types[j];
+             j++;
           }
         if (num > j)
           {
@@ -710,8 +710,8 @@ e_hints_window_type_get(E_Client *ec)
                malloc((num - j) * sizeof(Ecore_X_Window_Type));
              if (ec->netwm.extra_types)
                {
-                  for (i = j + 1; i < num; i++)
-                    ec->netwm.extra_types[i - (j + 1)] = types[i];
+                  for (i = j, k = 0; i < num; i++, k++)
+                    ec->netwm.extra_types[k] = types[i];
                   ec->netwm.extra_types_num = num - j;
                }
           }

-- 


Reply via email to