mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-05 18:01:34 +00:00
secur32: Fix GetComputerObjectNameW for the cases of NULL or insufficient buffer size.
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
e2cbfb68ad
commit
652090f598
1 changed files with 10 additions and 18 deletions
|
@ -996,29 +996,21 @@ BOOLEAN WINAPI GetComputerObjectNameW(
|
|||
if (GetComputerNameW(name, &size))
|
||||
{
|
||||
DWORD len = domainInfo->Name.Length + size + 3;
|
||||
if (lpNameBuffer)
|
||||
if (lpNameBuffer && *nSize >= len)
|
||||
{
|
||||
if (*nSize < len)
|
||||
{
|
||||
*nSize = len;
|
||||
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||
status = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
WCHAR bs[] = { '\\', 0 };
|
||||
WCHAR ds[] = { '$', 0 };
|
||||
lstrcpyW(lpNameBuffer, domainInfo->Name.Buffer);
|
||||
lstrcatW(lpNameBuffer, bs);
|
||||
lstrcatW(lpNameBuffer, name);
|
||||
lstrcatW(lpNameBuffer, ds);
|
||||
status = TRUE;
|
||||
}
|
||||
WCHAR bs[] = { '\\', 0 };
|
||||
WCHAR ds[] = { '$', 0 };
|
||||
lstrcpyW(lpNameBuffer, domainInfo->Name.Buffer);
|
||||
lstrcatW(lpNameBuffer, bs);
|
||||
lstrcatW(lpNameBuffer, name);
|
||||
lstrcatW(lpNameBuffer, ds);
|
||||
status = TRUE;
|
||||
}
|
||||
else /* just requesting length required */
|
||||
{
|
||||
*nSize = len;
|
||||
status = TRUE;
|
||||
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||
status = FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue