server: Return STATUS_KEY_DELETED when trying to retrieve the full name of a deleted key.

This fixes a server crash that can be triggered by deleting a key and then
trying to retrieve its name. In that case key->parent is NULL.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit 089b2528c2)
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
This commit is contained in:
Zebediah Figura 2021-06-30 22:08:09 -05:00 committed by Michael Stefaniuc
parent a59337fb7e
commit 83923e43d5
1 changed files with 6 additions and 0 deletions

View File

@ -402,6 +402,12 @@ static WCHAR *key_get_full_name( struct object *obj, data_size_t *ret_len )
data_size_t len = sizeof(root_name) - sizeof(WCHAR);
char *ret;
if (key->flags & KEY_DELETED)
{
set_error( STATUS_KEY_DELETED );
return NULL;
}
for (key = (struct key *)obj; key != root_key; key = key->parent) len += key->namelen + sizeof(WCHAR);
if (!(ret = malloc( len ))) return NULL;