check for invalid protocol values before accessing the array

SVN revision: 11310
This commit is contained in:
tsauerbeck 2004-08-22 22:04:12 +00:00 committed by tsauerbeck
parent 108be9ed1c
commit 288a11f6a9
1 changed files with 9 additions and 1 deletions

View File

@ -472,7 +472,11 @@ ecore_x_window_prop_protocol_set(Ecore_X_Window win,
int protos_count = 0;
int already_set = 0;
int i;
/* check for invalid values */
if (protocol < 0 || protocol >= ECORE_X_WM_PROTOCOL_NUM)
return;
proto = _ecore_x_atoms_wm_protocols[protocol];
if (!XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count))
@ -539,6 +543,10 @@ ecore_x_window_prop_protocol_isset(Ecore_X_Window win,
Atom proto, *protos = NULL;
int i, ret = 0, protos_count = 0;
/* check for invalid values */
if (protocol < 0 || protocol >= ECORE_X_WM_PROTOCOL_NUM)
return 0;
proto = _ecore_x_atoms_wm_protocols[protocol];
if (!XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count))