Hugh McMaster : reg: Validate the system key before commencing the export operation.
Alexandre Julliard
julliard at winehq.org
Mon Dec 4 14:58:19 CST 2017
Module: wine
Branch: master
Commit: 40643a43a453eee4cd73dfb82ddb07e58f8d5b53
URL: http://source.winehq.org/git/wine.git/?a=commit;h=40643a43a453eee4cd73dfb82ddb07e58f8d5b53
Author: Hugh McMaster <hugh.mcmaster at outlook.com>
Date: Sun Dec 3 06:50:11 2017 +0000
reg: Validate the system key before commencing the export operation.
Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
programs/reg/export.c | 6 ++++++
programs/reg/reg.c | 2 +-
programs/reg/reg.h | 1 +
3 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/programs/reg/export.c b/programs/reg/export.c
index 530d11b..720b9ef 100644
--- a/programs/reg/export.c
+++ b/programs/reg/export.c
@@ -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;
diff --git a/programs/reg/reg.c b/programs/reg/reg.c
index 7affdd2..a65bfc8 100644
--- a/programs/reg/reg.c
+++ b/programs/reg/reg.c
@@ -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;
diff --git a/programs/reg/reg.h b/programs/reg/reg.h
index b4751e4..3b5ab86 100644
--- a/programs/reg/reg.h
+++ b/programs/reg/reg.h
@@ -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);
More information about the wine-cvs
mailing list