nla and cmdline: integrated feedback
* fix possible problems with 0 size lengths * add return value checks
This commit is contained in:
parent
af81a91ea7
commit
09445c2b0e
@ -2264,17 +2264,23 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
|
|||||||
|
|
||||||
if (!settings->Domain && user)
|
if (!settings->Domain && user)
|
||||||
{
|
{
|
||||||
freerdp_parse_username(user, &settings->Username, &settings->Domain);
|
int ret;
|
||||||
|
ret = freerdp_parse_username(user, &settings->Username, &settings->Domain);
|
||||||
free(user);
|
free(user);
|
||||||
|
if (ret != 0 )
|
||||||
|
return COMMAND_LINE_ERROR;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
settings->Username = user;
|
settings->Username = user;
|
||||||
|
|
||||||
if (!settings->GatewayDomain && gwUser)
|
if (!settings->GatewayDomain && gwUser)
|
||||||
{
|
{
|
||||||
freerdp_parse_username(gwUser, &settings->GatewayUsername,
|
int ret;
|
||||||
|
ret = freerdp_parse_username(gwUser, &settings->GatewayUsername,
|
||||||
&settings->GatewayDomain);
|
&settings->GatewayDomain);
|
||||||
free(gwUser);
|
free(gwUser);
|
||||||
|
if (ret != 0)
|
||||||
|
return COMMAND_LINE_ERROR;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
settings->GatewayUsername = gwUser;
|
settings->GatewayUsername = gwUser;
|
||||||
|
@ -891,14 +891,18 @@ BOOL nla_read_ts_password_creds(rdpNla* nla, wStream* s)
|
|||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
nla->identity->DomainLength = (UINT32) length;
|
nla->identity->DomainLength = (UINT32) length;
|
||||||
nla->identity->Domain = (UINT16*) malloc(length);
|
if (nla->identity->DomainLength > 0)
|
||||||
if (!nla->identity->Domain)
|
{
|
||||||
return FALSE;
|
nla->identity->Domain = (UINT16*) malloc(length);
|
||||||
CopyMemory(nla->identity->Domain, Stream_Pointer(s), nla->identity->DomainLength);
|
if (!nla->identity->Domain)
|
||||||
Stream_Seek(s, nla->identity->DomainLength);
|
return FALSE;
|
||||||
nla->identity->DomainLength /= 2;
|
CopyMemory(nla->identity->Domain, Stream_Pointer(s), nla->identity->DomainLength);
|
||||||
|
Stream_Seek(s, nla->identity->DomainLength);
|
||||||
|
nla->identity->DomainLength /= 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
nla->identity->Domain = NULL;
|
||||||
|
|
||||||
/* [1] userName (OCTET STRING) */
|
/* [1] userName (OCTET STRING) */
|
||||||
if (!ber_read_contextual_tag(s, 1, &length, TRUE) ||
|
if (!ber_read_contextual_tag(s, 1, &length, TRUE) ||
|
||||||
@ -907,12 +911,17 @@ BOOL nla_read_ts_password_creds(rdpNla* nla, wStream* s)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
nla->identity->UserLength = (UINT32) length;
|
nla->identity->UserLength = (UINT32) length;
|
||||||
nla->identity->User = (UINT16*) malloc(length);
|
if (nla->identity->PasswordLength > 0)
|
||||||
if (!nla->identity->User)
|
{
|
||||||
return FALSE;
|
nla->identity->User = (UINT16 *) malloc(length);
|
||||||
CopyMemory(nla->identity->User, Stream_Pointer(s), nla->identity->UserLength);
|
if (!nla->identity->User)
|
||||||
Stream_Seek(s, nla->identity->UserLength);
|
return FALSE;
|
||||||
nla->identity->UserLength /= 2;
|
CopyMemory(nla->identity->User, Stream_Pointer(s), nla->identity->UserLength);
|
||||||
|
Stream_Seek(s, nla->identity->UserLength);
|
||||||
|
nla->identity->UserLength /= 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
nla->identity->User = NULL;
|
||||||
|
|
||||||
/* [2] password (OCTET STRING) */
|
/* [2] password (OCTET STRING) */
|
||||||
if (!ber_read_contextual_tag(s, 2, &length, TRUE) ||
|
if (!ber_read_contextual_tag(s, 2, &length, TRUE) ||
|
||||||
@ -921,12 +930,18 @@ BOOL nla_read_ts_password_creds(rdpNla* nla, wStream* s)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
nla->identity->PasswordLength = (UINT32) length;
|
nla->identity->PasswordLength = (UINT32) length;
|
||||||
nla->identity->Password = (UINT16*) malloc(length);
|
if (nla->identity->PasswordLength > 0)
|
||||||
if (!nla->identity->Password)
|
{
|
||||||
return FALSE;
|
nla->identity->Password = (UINT16 *) malloc(length);
|
||||||
CopyMemory(nla->identity->Password, Stream_Pointer(s), nla->identity->PasswordLength);
|
if (!nla->identity->Password)
|
||||||
Stream_Seek(s, nla->identity->PasswordLength);
|
return FALSE;
|
||||||
nla->identity->PasswordLength /= 2;
|
CopyMemory(nla->identity->Password, Stream_Pointer(s), nla->identity->PasswordLength);
|
||||||
|
Stream_Seek(s, nla->identity->PasswordLength);
|
||||||
|
nla->identity->PasswordLength /= 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
nla->identity->Password = NULL;
|
||||||
|
|
||||||
nla->identity->Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE;
|
nla->identity->Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
Loading…
Reference in New Issue
Block a user