From 1fd51d918306f296b73358ebbdb16ee5dcf3847c Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Wed, 4 Mar 2020 09:15:31 +0100 Subject: [PATCH] Fixed clang scanbuild warnings. --- channels/drdynvc/client/drdynvc_main.c | 2 +- channels/rdpsnd/client/rdpsnd_main.c | 10 ++++++++-- winpr/libwinpr/sspi/NTLM/ntlm_compute.c | 4 +++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/channels/drdynvc/client/drdynvc_main.c b/channels/drdynvc/client/drdynvc_main.c index abf0df796..c4a507303 100644 --- a/channels/drdynvc/client/drdynvc_main.c +++ b/channels/drdynvc/client/drdynvc_main.c @@ -794,7 +794,7 @@ static UINT drdynvc_write_data(drdynvcPlugin* drdynvc, UINT32 ChannelId, const B UINT8 cbChId; UINT8 cbLen; unsigned long chunkLength; - UINT status; + UINT status = CHANNEL_RC_BAD_INIT_HANDLE; if (!drdynvc) return CHANNEL_RC_BAD_CHANNEL_HANDLE; diff --git a/channels/rdpsnd/client/rdpsnd_main.c b/channels/rdpsnd/client/rdpsnd_main.c index a6bbefdfe..9644afadb 100644 --- a/channels/rdpsnd/client/rdpsnd_main.c +++ b/channels/rdpsnd/client/rdpsnd_main.c @@ -1096,7 +1096,10 @@ static VOID VCAPITYPE rdpsnd_virtual_channel_open_event_ex(LPVOID lpUserParam, D switch (event) { case CHANNEL_EVENT_DATA_RECEIVED: - if (!rdpsnd || (rdpsnd->OpenHandle != openHandle)) + if (!rdpsnd) + return; + + if (rdpsnd->OpenHandle != openHandle) { WLog_ERR(TAG, "%s error no match", rdpsnd_is_dyn_str(rdpsnd->dynamic)); return; @@ -1239,7 +1242,10 @@ static VOID VCAPITYPE rdpsnd_virtual_channel_init_event_ex(LPVOID lpUserParam, L UINT error = CHANNEL_RC_OK; rdpsndPlugin* plugin = (rdpsndPlugin*)lpUserParam; - if (!plugin || (plugin->InitHandle != pInitHandle)) + if (!plugin) + return; + + if (plugin->InitHandle != pInitHandle) { WLog_ERR(TAG, "%s error no match", rdpsnd_is_dyn_str(plugin->dynamic)); return; diff --git a/winpr/libwinpr/sspi/NTLM/ntlm_compute.c b/winpr/libwinpr/sspi/NTLM/ntlm_compute.c index b489414c7..6d2945498 100644 --- a/winpr/libwinpr/sspi/NTLM/ntlm_compute.c +++ b/winpr/libwinpr/sspi/NTLM/ntlm_compute.c @@ -314,7 +314,9 @@ static int ntlm_compute_ntlm_v2_hash(NTLM_CONTEXT* context, BYTE* hash) if (memcmp(context->NtlmV2Hash, NTLM_NULL_BUFFER, 16) != 0) return 1; - if (memcmp(context->NtlmHash, NTLM_NULL_BUFFER, 16) != 0) + if (!credentials) + return -1; + else if (memcmp(context->NtlmHash, NTLM_NULL_BUFFER, 16) != 0) { NTOWFv2FromHashW(context->NtlmHash, (LPWSTR)credentials->identity.User, credentials->identity.UserLength * 2, (LPWSTR)credentials->identity.Domain,