]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libcli/smb: Fix failure of Smb3UnixTests.test_create_context_reparse
authorNoel Power <noel.power@suse.com>
Wed, 28 Aug 2024 15:19:27 +0000 (16:19 +0100)
committerVolker Lendecke <vl@samba.org>
Wed, 28 Aug 2024 18:38:01 +0000 (18:38 +0000)
On tumbleweed at least the definition in py_reparse_put of 'reserved' as
'unsigned' causes the tag value to be overwritten. Note: ParseTuple is
given a format of 'Kk' where
  K = unsigned long long (for tag)
  k = unsigned long      (for reserved)

The problem is 'reserved' is defined as 'unsigned' which on a
64 bit linux system has size 4. The size however of the 'unsigned long' type
on the same 64 bit system is 8. This causes 'tag' to be overwritten by
the value of 'reserved' because it's destination size is smaller than
expected.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15702
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Aug 28 18:38:01 UTC 2024 on atb-devel-224

libcli/smb/py_reparse_symlink.c

index d28a8fd8b93fb7d647aed75d7f5c9b0aaddcda71..5e2e961ef01d7d61d708fe7e8c7338262ca01ccb 100644 (file)
@@ -30,7 +30,7 @@ static PyObject *py_reparse_put(PyObject *module, PyObject *args)
        char *reparse = NULL;
        Py_ssize_t reparse_len;
        unsigned long long tag = 0;
-       unsigned reserved = 0;
+       unsigned long reserved = 0;
        uint8_t *buf = NULL;
        ssize_t buflen;
        PyObject *result = NULL;