mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[SAMLIB] Check the server name in the binding routine
This commit is contained in:
parent
5b6e8af1bd
commit
be65a8568b
1 changed files with 21 additions and 0 deletions
|
@ -77,6 +77,27 @@ PSAMPR_SERVER_NAME_bind(PSAMPR_SERVER_NAME pszSystemName)
|
|||
|
||||
TRACE("PSAMPR_SERVER_NAME_bind(%S)\n", pszSystemName);
|
||||
|
||||
/* Check the server name prefix and server name length */
|
||||
if (pszSystemName != NULL)
|
||||
{
|
||||
int nLength = wcslen(pszSystemName);
|
||||
int nNameLength = nLength;
|
||||
|
||||
if (nLength >= 1 && pszSystemName[0] == L'\\')
|
||||
nNameLength--;
|
||||
|
||||
if (nLength >= 2 && pszSystemName[1] == L'\\')
|
||||
nNameLength--;
|
||||
|
||||
if (((nLength - nNameLength != 0) &&
|
||||
(nLength - nNameLength != 2)) ||
|
||||
(nNameLength == 0))
|
||||
{
|
||||
WARN("Invalid server name %S", pszSystemName);
|
||||
RpcRaiseException(STATUS_OBJECT_NAME_INVALID);
|
||||
}
|
||||
}
|
||||
|
||||
status = RpcStringBindingComposeW(NULL,
|
||||
L"ncacn_np",
|
||||
pszSystemName,
|
||||
|
|
Loading…
Reference in a new issue