pyldb: Avoid use-after-free in msg_diff()
commit0c36416e319e307022d11a915a4ac508c0ab2eea
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Sun, 12 Sep 2021 23:15:17 +0000 (13 11:15 +1200)
committerStefan Metzmacher <metze@samba.org>
Thu, 28 Oct 2021 08:58:16 +0000 (28 08:58 +0000)
tree1f420db3fe467b698d5978783f15e6d9c5fd0744
parent400d04533ab3525f29721dffa137faf096c274e8
pyldb: Avoid use-after-free in msg_diff()

Make a deep copy of the message elements in msg_diff() so that if either
of the input messages are deallocated early, the result does not refer
to non-existing elements.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14645
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14836
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14848

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
[abartlet@samba.org backported from commit
 19a2af02f57d99db8ed3c6b028c3abdf4b553700 due to conflicts in
 the knownfail.d/python-segfaults file]

Autobuild-User(v4-14-test): Jule Anger <janger@samba.org>
Autobuild-Date(v4-14-test): Wed Sep 29 13:14:22 UTC 2021 on sn-devel-184
lib/ldb/pyldb.c
selftest/knownfail.d/python-segfaults