reg: Validate the system key before commencing the export operation.

Signed-off-by: Hugh McMaster <hugh.mcmaster@outlook.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hugh McMaster 2017-12-03 06:50:11 +00:00 committed by Alexandre Julliard
parent d4255506d5
commit 40643a43a4
3 changed files with 8 additions and 1 deletions

View File

@ -38,9 +38,15 @@ static BOOL is_overwrite_switch(const WCHAR *s)
int reg_export(int argc, WCHAR *argv[])
{
HKEY root;
WCHAR *path, *long_key;
if (argc == 3 || argc > 5)
goto error;
if (!parse_registry_key(argv[2], &root, &path, &long_key))
return 1;
if (argc == 5 && !is_overwrite_switch(argv[4]))
goto error;

View File

@ -873,7 +873,7 @@ static WCHAR *get_long_key(HKEY root, WCHAR *path)
return long_key;
}
static BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path, WCHAR **long_key)
BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path, WCHAR **long_key)
{
if (!sane_path(key))
return FALSE;

View File

@ -29,6 +29,7 @@ void *heap_xrealloc(void *buf, size_t size);
BOOL heap_free(void *buf);
void WINAPIV output_message(unsigned int id, ...);
HKEY path_get_rootkey(const WCHAR *path);
BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path, WCHAR **long_key);
/* import.c */
int reg_import(const WCHAR *filename);