s3:pylibsmb: make use of PyBytes_FromStringAndSize() in py_cli_read()
authorStefan Metzmacher <metze@samba.org>
Fri, 7 Dec 2018 12:47:40 +0000 (13:47 +0100)
committerStefan Metzmacher <metze@samba.org>
Thu, 13 Dec 2018 07:52:23 +0000 (08:52 +0100)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Tim Beale <timbeale@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/libsmb/pylibsmb.c

index 19587a8..bb1d2b7 100644 (file)
@@ -794,7 +794,7 @@ static PyObject *py_cli_read(struct py_cli_state *self, PyObject *args,
                PyErr_SetNTSTATUS(status);
                return NULL;
        }
-       result = Py_BuildValue("s#", (char *)buf, (int)buflen);
+       result = PyBytes_FromStringAndSize((const char *)buf, buflen);
        TALLOC_FREE(req);
        return result;
 }