1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

samdb: Fix an uninitialized variable read

When the "(status == LDB_SUCCESS && msg != NULL)" condition in this
routine is not evaluating to true, "new_rid" is read uninitialized,
comparing it against ~0. Initialize new_rid and compare it against
UINT32_MAX instead of ~0.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Volker Lendecke 2021-07-23 08:47:47 +02:00 committed by Jeremy Allison
parent 621f561a9c
commit d2a08f5d67

View File

@ -911,7 +911,7 @@ static void log_user_primary_group_change(
const int status)
{
TALLOC_CTX *ctx = talloc_new(NULL);
uint32_t new_rid;
uint32_t new_rid = UINT32_MAX;
struct dom_sid *account_sid = NULL;
int ret;
const struct ldb_message *msg = dsdb_audit_get_message(acc->request);
@ -945,7 +945,7 @@ static void log_user_primary_group_change(
* Otherwise only log if the primary group has actually changed.
*/
if (account_sid != NULL &&
new_rid != ~0 &&
new_rid != UINT32_MAX &&
acc->primary_group != new_rid) {
const char* group = get_primary_group_dn(
ctx,