From f8fb6f326129267c7742947943df3f920c8cb54f Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Sun, 7 Jul 2019 13:47:51 +1200 Subject: auth/pycreds/encrypt_netr_crypt_password: don't segfault Non-talloc objects were treated as talloc objects, to no good effect Signed-off-by: Douglas Bagnall Reviewed-by: Gary Lockyer Reviewed-by: Andrew Bartlett --- auth/credentials/pycredentials.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'auth') diff --git a/auth/credentials/pycredentials.c b/auth/credentials/pycredentials.c index 5002bb86e1c..91e9276473d 100644 --- a/auth/credentials/pycredentials.c +++ b/auth/credentials/pycredentials.c @@ -909,7 +909,12 @@ static PyObject *py_creds_encrypt_netr_crypt_password(PyObject *self, if (!PyArg_ParseTuple(args, "|O", &py_cp)) { return NULL; } + pwd = pytalloc_get_type(py_cp, struct netr_CryptPassword); + if (pwd == NULL) { + /* pytalloc_get_type sets TypeError */ + return NULL; + } data.length = sizeof(struct netr_CryptPassword); data.data = (uint8_t *)pwd; status = netlogon_creds_session_encrypt(creds->netlogon_creds, data); -- cgit v1.2.1