Merge pull request #4969 from akallabeth/covscan_fix

Covscan fixes
This commit is contained in:
Bernhard Miklautz 2018-11-05 10:44:01 +00:00 committed by GitHub
commit aecc77cd77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 34 additions and 11 deletions

View File

@ -157,7 +157,7 @@ static DWORD WINAPI audin_oss_thread_func(LPVOID arg)
UINT error = 0;
DWORD status;
if (arg == NULL)
if (oss == NULL)
{
error = ERROR_INVALID_PARAMETER;
goto err_out;

View File

@ -44,6 +44,9 @@ static wStream* rpc_ntlm_http_request(HttpContext* http, const char* method,
request = http_request_new();
if (!request)
goto fail;
if (ntlmToken)
base64NtlmToken = crypto_base64_encode(ntlmToken->pvBuffer, ntlmToken->cbBuffer);
@ -52,7 +55,7 @@ static wStream* rpc_ntlm_http_request(HttpContext* http, const char* method,
if (!http_request_set_method(request, method) ||
!http_request_set_content_length(request, contentLength) ||
!http_request_set_uri(request, uri))
return NULL;
goto fail;
if (base64NtlmToken)
{

View File

@ -328,7 +328,7 @@ static wStream* rdg_build_http_request(rdpRdg* rdg, const char* method,
HttpRequest* request = NULL;
const char* uri;
if (!rdg || !method )
if (!rdg || !method)
return NULL;
uri = http_context_get_uri(rdg->http);
@ -693,9 +693,7 @@ static BOOL rdg_tls_connect(rdpRdg* rdg, rdpTls* tls, const char* peerAddress, i
peerPort, timeout);
if (sockfd < 0)
{
return FALSE;
}
socketBio = BIO_new(BIO_s_simple_socket());
@ -710,8 +708,7 @@ static BOOL rdg_tls_connect(rdpRdg* rdg, rdpTls* tls, const char* peerAddress, i
if (!bufferedBio)
{
closesocket(sockfd);
BIO_free(socketBio);
BIO_free_all(socketBio);
return FALSE;
}
@ -722,7 +719,10 @@ static BOOL rdg_tls_connect(rdpRdg* rdg, rdpTls* tls, const char* peerAddress, i
{
if (!proxy_connect(settings, bufferedBio, proxyUsername, proxyPassword, settings->GatewayHostname,
settings->GatewayPort))
{
BIO_free_all(bufferedBio);
return FALSE;
}
}
if (!status)

View File

@ -671,24 +671,36 @@ static BOOL rpc_channel_tls_connect(RpcChannel* channel, int timeout)
socketBio = BIO_new(BIO_s_simple_socket());
if (!socketBio)
{
closesocket(sockfd);
return FALSE;
}
BIO_set_fd(socketBio, sockfd, BIO_CLOSE);
bufferedBio = BIO_new(BIO_s_buffered_socket());
if (!bufferedBio)
{
BIO_free_all(socketBio);
return FALSE;
}
bufferedBio = BIO_push(bufferedBio, socketBio);
if (!BIO_set_nonblock(bufferedBio, TRUE))
{
BIO_free_all(bufferedBio);
return FALSE;
}
if (channel->client->isProxy)
{
if (!proxy_connect(settings, bufferedBio, proxyUsername, proxyPassword, settings->GatewayHostname,
settings->GatewayPort))
{
BIO_free_all(bufferedBio);
return FALSE;
}
}
channel->bio = bufferedBio;

View File

@ -224,22 +224,30 @@ wStream* transport_send_stream_init(rdpTransport* transport, int size)
BOOL transport_attach(rdpTransport* transport, int sockfd)
{
BIO* socketBio;
BIO* socketBio = NULL;
BIO* bufferedBio;
socketBio = BIO_new(BIO_s_simple_socket());
if (!socketBio)
return FALSE;
goto fail;
BIO_set_fd(socketBio, sockfd, BIO_CLOSE);
bufferedBio = BIO_new(BIO_s_buffered_socket());
if (!bufferedBio)
return FALSE;
goto fail;
bufferedBio = BIO_push(bufferedBio, socketBio);
transport->frontBio = bufferedBio;
return TRUE;
fail:
if (socketBio)
BIO_free_all(socketBio);
else
close(sockfd);
return FALSE;
}
BOOL transport_connect_rdp(rdpTransport* transport)
@ -1093,7 +1101,7 @@ BOOL transport_disconnect(rdpTransport* transport)
else
{
if (transport->frontBio)
BIO_free(transport->frontBio);
BIO_free_all(transport->frontBio);
}
if (transport->tsg)