From f273dcf6c5c89cac2b83851aa100419f17fd3191 Mon Sep 17 00:00:00 2001 From: Joseph Sutton Date: Tue, 21 Mar 2023 13:47:16 +1300 Subject: [PATCH] s4-drs: Don't skip over elements in uref_del_dest() If we remove an element, we should not skip over the element following. Signed-off-by: Joseph Sutton Reviewed-by: Andreas Schneider --- source4/rpc_server/drsuapi/updaterefs.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source4/rpc_server/drsuapi/updaterefs.c b/source4/rpc_server/drsuapi/updaterefs.c index 0be675ffe21..fede4bab388 100644 --- a/source4/rpc_server/drsuapi/updaterefs.c +++ b/source4/rpc_server/drsuapi/updaterefs.c @@ -144,6 +144,11 @@ static WERROR uref_del_dest(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx, if (i+1 < reps.count) { memmove(&reps.r[i], &reps.r[i+1], sizeof(reps.r[i])*(reps.count-(i+1))); } + /* + * If we remove an element, decrement i so that we don't + * skip over the element following. + */ + i--; reps.count--; found = true; }