From 26253f6de454f2c77581e9e6221374895414c105 Mon Sep 17 00:00:00 2001 From: Romain Perier Date: Fri, 30 Jan 2015 10:49:56 +0100 Subject: [PATCH] ecore_win32: don't allocate Ecore_Event_Key events with NULL keys If "keyname" and "key" are NULL an Ecore_Event_Key is allocated throught calloc. strlen() is called on these variables, which crashes the program. As it is not correct to return a key event for NULL keys to ecore, it is preferrable to return NULL and exit the function before the key event is allocated, which fixes the crash in the same time. @fix Signed-off-by: Cedric BAIL --- src/lib/ecore_win32/ecore_win32_event.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib/ecore_win32/ecore_win32_event.c b/src/lib/ecore_win32/ecore_win32_event.c index 2e1de2add9..f9d29a1a6f 100644 --- a/src/lib/ecore_win32/ecore_win32_event.c +++ b/src/lib/ecore_win32/ecore_win32_event.c @@ -1334,6 +1334,9 @@ _ecore_win32_event_keystroke_get(Ecore_Win32_Callback_Data *msg, } } + if (!keyname || !key) + return NULL; + e = (Ecore_Event_Key *)calloc(1, sizeof(Ecore_Event_Key) + strlen(keyname) + 1 + strlen(key) + 1 +