From 1763e8a2ba64517fece9f10f1a0011f31975318f Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Sat, 31 May 2014 23:40:42 +0200 Subject: Correct minor bug in ReadRegistryString function --- src/Common/Registry.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Common/Registry.c b/src/Common/Registry.c index 0c5d51b5..c7496471 100644 --- a/src/Common/Registry.c +++ b/src/Common/Registry.c @@ -104,12 +104,13 @@ char *ReadRegistryString (char *subKey, char *name, char *defaultValue, char *st char value[MAX_PATH*4]; DWORD size = sizeof (value); + str[maxLen-1] = 0; strncpy (str, defaultValue, maxLen-1); ZeroMemory (value, sizeof value); if (RegOpenKeyEx (HKEY_CURRENT_USER, subKey, 0, KEY_READ, &hkey) == ERROR_SUCCESS) - if (RegQueryValueEx (hkey, name, 0, 0, (LPBYTE) &value, &size) == ERROR_SUCCESS) + if (RegQueryValueEx (hkey, name, 0, 0, (LPBYTE) value, &size) == ERROR_SUCCESS) strncpy (str, value, maxLen-1); RegCloseKey (hkey); -- cgit v1.2.3