From: Dana Jansens Date: Tue, 4 Feb 2003 12:47:42 +0000 (+0000) Subject: watch for bad actions and contexts X-Git-Tag: openbox-3_0-rc1-RELEASE~2260 X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=df0447ce6d57c6ece97e69fc0874595e4ac0ae75;p=dana%2Fopenbox.git watch for bad actions and contexts --- diff --git a/src/python.cc b/src/python.cc index 84cfff29..a99416ae 100644 --- a/src/python.cc +++ b/src/python.cc @@ -101,6 +101,14 @@ PyObject *mbind(const std::string &button, ob::MouseContext::MC context, PyErr_SetString(PyExc_TypeError, "Invalid callback function."); return NULL; } + if(context < 0 || context >= MouseContext::NUM_MOUSE_CONTEXT) { + PyErr_SetString(PyExc_ValueError, "Invalid MouseContext"); + return NULL; + } + if(action < 0 || action >= MouseAction::NUM_MOUSE_ACTION) { + PyErr_SetString(PyExc_ValueError, "Invalid MouseAction"); + return NULL; + } if (!ob::openbox->bindings()->addButton(button, context, action, func)) {