1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

ldb: Don't wrongly claim to return message elements

If the LDB_UNPACK_DATA_FLAG_NO_ATTRS flag is set, we don't return any
elements, so we should set num_elements accordingly. This ensures
callers don't try to access elements that aren't there.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
Joseph Sutton 2023-01-27 08:02:18 +13:00 committed by Andreas Schneider
parent cb3c344a64
commit 0ff26aa0c5

View File

@ -610,6 +610,7 @@ static int ldb_unpack_data_flags_v1(struct ldb_context *ldb,
}
if (flags & LDB_UNPACK_DATA_FLAG_NO_ATTRS) {
message->num_elements = 0;
return 0;
}
@ -838,6 +839,7 @@ static int ldb_unpack_data_flags_v2(struct ldb_context *ldb,
}
if (flags & LDB_UNPACK_DATA_FLAG_NO_ATTRS) {
message->num_elements = 0;
return 0;
}