1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-07 00:58:40 +03:00

libcli/smb: Fix failure of Smb3UnixTests.test_create_context_reparse

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
This commit is contained in:
Noel Power 2024-08-28 16:19:27 +01:00 committed by Volker Lendecke
parent 5e278a5264
commit 56c4815402

View 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;