pyldb: Avoid use-after-free in msg_diff()
commit19a2af02f57d99db8ed3c6b028c3abdf4b553700
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Sun, 12 Sep 2021 23:15:17 +0000 (13 11:15 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 15 Sep 2021 07:59:31 +0000 (15 07:59 +0000)
tree5ea779cf2fb4eb52340e7e31ea45910a4d790589
parentc2bbe774ce03661666a1f48922a9ab681ef4f64b
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=14642
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14836

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>
lib/ldb/pyldb.c
selftest/knownfail.d/python-segfaults