mirror of
https://github.com/samba-team/samba.git
synced 2025-02-26 21:57:41 +03:00
s4/rpc/py_security: don't deref NULL for invalid values
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
5405f2ad7e
commit
2d1c269a9e
@ -435,10 +435,18 @@ static void py_token_patch(PyTypeObject *type)
|
|||||||
static PyObject *py_privilege_name(PyObject *self, PyObject *args)
|
static PyObject *py_privilege_name(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
int priv;
|
int priv;
|
||||||
if (!PyArg_ParseTuple(args, "i", &priv))
|
const char *name = NULL;
|
||||||
|
if (!PyArg_ParseTuple(args, "i", &priv)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
name = sec_privilege_name(priv);
|
||||||
|
if (name == NULL) {
|
||||||
|
PyErr_Format(PyExc_ValueError,
|
||||||
|
"Invalid privilege LUID: %d", priv);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return PyUnicode_FromString(sec_privilege_name(priv));
|
return PyUnicode_FromString(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *py_privilege_id(PyObject *self, PyObject *args)
|
static PyObject *py_privilege_id(PyObject *self, PyObject *args)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user