MSDN says RegQueryValueEx might not always return null terminated strings

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4115 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2005-06-21 20:52:10 +00:00
parent f189322a12
commit 3eb2576adb

View file

@ -1198,7 +1198,7 @@ static int NSISCALL ExecuteEntry(entry *entry_)
p[0]=0;
if (hKey)
{
DWORD l = NSIS_MAX_STRLEN;
DWORD l = NSIS_MAX_STRLEN - 1;
DWORD t;
if (RegQueryValueEx(hKey,buf3,NULL,&t,p,&l) != ERROR_SUCCESS ||
@ -1214,7 +1214,11 @@ static int NSISCALL ExecuteEntry(entry *entry_)
if (!parm4) exec_error++;
myitoa(p,*((DWORD*)p));
}
else if (parm4) exec_error++;
else
{
if (parm4) exec_error++;
p[l]=0;
}
}
RegCloseKey(hKey);
}