devilhorns pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=59a689faa47b681e5b7005715dc02c5957bb60cc

commit 59a689faa47b681e5b7005715dc02c5957bb60cc
Author: Chris Michael <cp.mich...@samsung.com>
Date:   Wed Mar 7 09:50:58 2018 -0500

    ecore-wl2: Check for valid string before passing to strlen()
    
    As strlen() cannot accept NULL (segfaults), we should check for valid
    key, keyname, and compose strings here before passing to strlen().
    
    @fix
    
    Signed-off-by: Chris Michael <cp.mich...@samsung.com>
---
 src/lib/ecore_wl2/ecore_wl2_input.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/lib/ecore_wl2/ecore_wl2_input.c 
b/src/lib/ecore_wl2/ecore_wl2_input.c
index c252593350..3c8c3d4183 100644
--- a/src/lib/ecore_wl2/ecore_wl2_input.c
+++ b/src/lib/ecore_wl2/ecore_wl2_input.c
@@ -637,12 +637,11 @@ _ecore_wl2_input_key_send(Ecore_Wl2_Input *input, 
Ecore_Wl2_Window *window, xkb_
    _ecore_wl2_input_key_translate(sym, input->keyboard.modifiers,
                                   compose, sizeof(compose));
 
-   name_len = strlen(keyname);
-   key_len = strlen(key);
-   comp_len = strlen(compose);
+   name_len = (keyname) ? strlen(keyname) : 0;
+   key_len = (key) ? strlen(key) : 0;
+   comp_len = (compose) ? strlen(compose) : 0;
 
-   ev = calloc(1, sizeof(Ecore_Event_Key) + key_len + name_len +
-               ((compose[0] != '\0') ? comp_len : 0) + 3);
+   ev = calloc(1, sizeof(Ecore_Event_Key) + key_len + name_len + comp_len + 3);
    if (!ev) return;
 
    ev->keyname = (char *)(ev + 1);

-- 


Reply via email to