]> git.ipfire.org Git - thirdparty/samba.git/commit
CVE-2023-0614 ldb:tests: Ensure ldb_val data is zero-terminated
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Tue, 14 Feb 2023 23:34:51 +0000 (12:34 +1300)
committerJule Anger <janger@samba.org>
Mon, 20 Mar 2023 09:03:37 +0000 (10:03 +0100)
commit7153af801e59f4cfee54ae020bfca13c73f63e93
tree751dfa098cb3c788e35a5cd386eb47d4106922fc
parentc3419c288c612743d42179d46091e28ba4c9939b
CVE-2023-0614 ldb:tests: Ensure ldb_val data is zero-terminated

If the value of an ldb message element is not zero-terminated, calling
ldb_msg_find_attr_as_string() will cause the function to read off the
end of the buffer in an attempt to verify that the value is
zero-terminated. This can cause unexpected behaviour and make the test
randomly fail.

To avoid this, we must have a terminating null byte that is *not*
counted as part of the length, and so we must calculate the length with
strlen() rather than sizeof.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15270

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/ldb/tests/ldb_filter_attrs_test.c