From: chenzhengyong <chenzhengyong(a)uniontech.com> When `index == cur_index + 1`, the modification logic incorrectly altered the value of the subkey following the current key, leading to unintended changes in other keys. Signed-off-by: chenzhengyong <chenzhengyong(a)uniontech.com> --- server/registry.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/registry.c b/server/registry.c index 7cfefc7a6c3..bb7897ef731 100644 --- a/server/registry.c +++ b/server/registry.c @@ -1038,7 +1038,7 @@ static void rename_key( struct key *key, const struct unicode_str *new_name ) for (cur_index = 0; cur_index <= parent->last_subkey; cur_index++) if (parent->subkeys[cur_index] == key) break; - if (cur_index < index && (index - cur_index) > 1) + if (cur_index < index) { --index; for (i = cur_index; i < index; ++i) parent->subkeys[i] = parent->subkeys[i+1]; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9247