Nigel Liang : winecfg:
Fix crash caused by calling set_reg_key with NULL value.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Aug 6 08:03:45 CDT 2007
Module: wine
Branch: master
Commit: 4536a9d66d11c46028952de5b44ccf52da43a1b5
URL: http://source.winehq.org/git/wine.git/?a=commit;h=4536a9d66d11c46028952de5b44ccf52da43a1b5
Author: Nigel Liang <ncliang at gmail.com>
Date: Fri Aug 3 18:34:57 2007 -0700
winecfg: Fix crash caused by calling set_reg_key with NULL value.
---
programs/winecfg/winecfg.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/programs/winecfg/winecfg.c b/programs/winecfg/winecfg.c
index 84dd4c8..1a19888 100644
--- a/programs/winecfg/winecfg.c
+++ b/programs/winecfg/winecfg.c
@@ -464,15 +464,19 @@ static void set_reg_key_ex(HKEY root, const WCHAR *path, const WCHAR *name, cons
void set_reg_key(HKEY root, const char *path, const char *name, const char *value)
{
- WCHAR *wpath, *wname, *wvalue;
+ WCHAR *wpath, *wname, *wvalue = NULL;
wpath = HeapAlloc(GetProcessHeap(), 0, (strlen(path)+1)*sizeof(WCHAR));
wname = HeapAlloc(GetProcessHeap(), 0, (strlen(name)+1)*sizeof(WCHAR));
- wvalue = HeapAlloc(GetProcessHeap(), 0, (strlen(value)+1)*sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, path, -1, wpath, strlen(path)+1);
MultiByteToWideChar(CP_ACP, 0, name, -1, wname, strlen(name)+1);
- MultiByteToWideChar(CP_ACP, 0, value, -1, wvalue, strlen(value)+1);
+
+ if (value)
+ {
+ wvalue = HeapAlloc(GetProcessHeap(), 0, (strlen(value)+1)*sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP, 0, value, -1, wvalue, strlen(value)+1);
+ }
set_reg_key_ex(root, wpath, wname, wvalue, REG_SZ);
More information about the wine-cvs
mailing list