From: Douglas Bagnall Date: Sun, 7 Jul 2019 01:47:51 +0000 (+1200) Subject: auth/pycreds/encrypt_netr_crypt_password: don't segfault X-Git-Tag: tdb-1.4.2~576 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f8fb6f326129267c7742947943df3f920c8cb54f;p=thirdparty%2Fsamba.git 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 --- 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); diff --git a/selftest/knownfail.d/python-segfaults b/selftest/knownfail.d/python-segfaults index 76fc645c2b6..1be0566dcb1 100644 --- a/selftest/knownfail.d/python-segfaults +++ b/selftest/knownfail.d/python-segfaults @@ -1,2 +1 @@ -samba.tests.segfault.samba.tests.segfault.SegfaultTests.test_encrypt_netr_crypt_password samba.tests.segfault.samba.tests.segfault.SegfaultTests.test_net_replicate_init__3