1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-24 13:57:43 +03:00

libcli/security: simplify logic in add_sid_to_array_attrs()

(struct auth_SidAttr) {} makes sure we don't leave uninitialized
memory in case struct auth_SidAttr will change (which will happen in
the next commits).

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
This commit is contained in:
Stefan Metzmacher 2025-01-29 09:43:44 +01:00
parent 0dc403192b
commit bd7b769c20

View File

@ -444,6 +444,10 @@ NTSTATUS add_sid_to_array_attrs(TALLOC_CTX *mem_ctx,
{
struct auth_SidAttr *tmp = NULL;
if (sid == NULL) {
return NT_STATUS_INVALID_PARAMETER;
}
if ((*num) == UINT32_MAX) {
return NT_STATUS_INTEGER_OVERFLOW;
}
@ -455,8 +459,10 @@ NTSTATUS add_sid_to_array_attrs(TALLOC_CTX *mem_ctx,
}
*sids = tmp;
sid_copy(&((*sids)[*num].sid), sid);
(*sids)[*num].attrs = attrs;
(*sids)[*num] = (struct auth_SidAttr) {
.sid = *sid,
.attrs = attrs,
};
*num += 1;
return NT_STATUS_OK;