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 <cedric@osg.samsung.com>
This commit is contained in:
Romain Perier 2015-01-30 10:49:56 +01:00 committed by Cedric BAIL
parent 0e671630f1
commit 26253f6de4
1 changed files with 3 additions and 0 deletions

View File

@ -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 +