]> git.ipfire.org Git - thirdparty/samba.git/commit
ldb:tests: Avoid that the debug function overwrites memory
authorAndreas Schneider <asn@samba.org>
Wed, 4 Dec 2019 12:29:26 +0000 (13:29 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 5 Dec 2019 15:35:37 +0000 (15:35 +0000)
commit520bb70dfd65d0a5236aa83cb8d662be62169e54
treee137581d076c74f486907f2e9a5b38a1f6aef463
parent8db0c1bff6f42feabd2e4d9dfb13ae12cc29607b
ldb:tests: Avoid that the debug function overwrites memory

We are setting ldb_debug_string() as the ldb debug function. The context
we give it is only valid as long as we're in that function.

On failure, we jump to the teardown function. The pointer for
debug_string isn't valid anymore, but the ldb debug system still points
to that address, and when we store the location of the allocated string,
we overwrite memory, in that case something from talloc and a
talloc_free() then jumps into the nirvana.

Thanks to Florian Weimer who helped debugging this.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
lib/ldb/tests/ldb_mod_op_test.c