From bff3ac250e9d4e7d91820eb53c28257aa38fff88 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 9 Jan 2014 15:20:21 +0100 Subject: s3-passdb: Fix string duplication to pointers. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Andreas Schneider Reviewed-by: Günther Deschner Autobuild-User(master): Andreas Schneider Autobuild-Date(master): Thu Jan 9 22:35:25 CET 2014 on sn-devel-104 --- source3/passdb/py_passdb.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'source3/passdb') diff --git a/source3/passdb/py_passdb.c b/source3/passdb/py_passdb.c index 87dbb5dd435..2d3b6371b31 100644 --- a/source3/passdb/py_passdb.c +++ b/source3/passdb/py_passdb.c @@ -2265,8 +2265,18 @@ static PyObject *py_pdb_set_aliasinfo(pytalloc_Object *self, PyObject *args) alias_sid = pytalloc_get_ptr(py_alias_sid); - fstrcpy(alias_info.acct_name, PyString_AsString(PyDict_GetItemString(py_alias_info, "acct_name"))); - fstrcpy(alias_info.acct_desc, PyString_AsString(PyDict_GetItemString(py_alias_info, "acct_desc"))); + alias_info.acct_name = talloc_strdup(frame, PyString_AsString(PyDict_GetItemString(py_alias_info, "acct_name"))); + if (alias_info.acct_name == NULL) { + PyErr_Format(py_pdb_error, "Unable to allocate memory"); + talloc_free(frame); + return NULL; + } + alias_info.acct_desc = talloc_strdup(frame, PyString_AsString(PyDict_GetItemString(py_alias_info, "acct_desc"))); + if (alias_info.acct_desc == NULL) { + PyErr_Format(py_pdb_error, "Unable to allocate memory"); + talloc_free(frame); + return NULL; + } status = methods->set_aliasinfo(methods, alias_sid, &alias_info); if (!NT_STATUS_IS_OK(status)) { -- cgit