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

s4:torture: Fully initialize struct samr_OpenUser

"Error: UNINIT (CWE-457):
samba-4.20.0rc2/source4/torture/rpc/samr.c:7381: var_decl: Declaring variable ""r"" without initializer.
samba-4.20.0rc2/source4/torture/rpc/samr.c:7428: uninit_use: Using uninitialized value ""r.out.result.v"".
 7426|   		torture_assert_ntstatus_ok(tctx, dcerpc_samr_QueryUserInfo_r(b, tctx, &q),
 7427|   			""QueryUserInfo failed"");
 7428|-> 		if (!NT_STATUS_IS_OK(r.out.result)) {
 7429|   			torture_result(tctx, TORTURE_FAIL, ""QueryUserInfo(%u) failed - %s\n"", r.in.rid, nt_errstr(r.out.result));
 7430|   			return false;"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
This commit is contained in:
Andreas Schneider 2024-06-24 15:09:21 +02:00 committed by Andreas Schneider
parent dd896862d0
commit 54ce370f7d

View File

@ -7378,13 +7378,17 @@ static bool test_each_DisplayInfo_user(struct dcerpc_binding_handle *b,
struct samr_QueryDisplayInfo *querydisplayinfo, struct samr_QueryDisplayInfo *querydisplayinfo,
bool *seen_testuser) bool *seen_testuser)
{ {
struct samr_OpenUser r; struct samr_OpenUser r = {
.in = {
.domain_handle = querydisplayinfo->in.domain_handle,
.access_mask = SEC_FLAG_MAXIMUM_ALLOWED,
},
};
struct samr_QueryUserInfo q; struct samr_QueryUserInfo q;
union samr_UserInfo *info; union samr_UserInfo *info;
struct policy_handle user_handle; struct policy_handle user_handle;
int i, ret = true; int i, ret = true;
r.in.domain_handle = querydisplayinfo->in.domain_handle;
r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
for (i = 0; ; i++) { for (i = 0; ; i++) {
switch (querydisplayinfo->in.level) { switch (querydisplayinfo->in.level) {
case 1: case 1: