From 334765ffd7fd3704475d464db6657cba6bafda16 Mon Sep 17 00:00:00 2001 From: Ilya Shipitsin Date: Mon, 28 Nov 2016 17:27:29 +0500 Subject: [PATCH] resolved several cppcheck findings: [src/Cedar/Admin.c:418]: (error) Possible null pointer dereference: cedar [src/Cedar/Admin.c:616]: (error) Possible null pointer dereference: cedar [src/Cedar/WebUI.c:369]: (error) Uninitialized variable: retcode [src/Mayaqua/Encrypt.c:4485]: (error) Uninitialized variable: key [src/Mayaqua/Network.c:13548]: (error) Uninitialized variable: e --- src/Cedar/Admin.c | 5 +++-- src/Cedar/WebUI.c | 2 +- src/Mayaqua/Encrypt.c | 2 +- src/Mayaqua/Network.c | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Cedar/Admin.c b/src/Cedar/Admin.c index f0908f47..5baebb8a 100644 --- a/src/Cedar/Admin.c +++ b/src/Cedar/Admin.c @@ -410,11 +410,12 @@ PACK *AdminDispatch(RPC *rpc, char *name, PACK *p) server = a->Server; - if (server != NULL) + if (server == NULL) { - cedar = server->Cedar; + return NULL; } + cedar = server->Cedar; Lock(cedar->CedarSuperLock); if (true) diff --git a/src/Cedar/WebUI.c b/src/Cedar/WebUI.c index d188911c..0d4f2245 100644 --- a/src/Cedar/WebUI.c +++ b/src/Cedar/WebUI.c @@ -326,7 +326,7 @@ static wchar_t *WpListener(WEBUI *wu, LIST *params) WU_CONTEXT *context = WuGetContext(wu->Contexts, sessionkey); char *cmd = (char*)StrMapSearch(params, "CMD"); RPC_LISTENER t; - UINT retcode; + UINT retcode = ERR_NO_ERROR; if(context == NULL) { diff --git a/src/Mayaqua/Encrypt.c b/src/Mayaqua/Encrypt.c index 9914646b..8fdca916 100644 --- a/src/Mayaqua/Encrypt.c +++ b/src/Mayaqua/Encrypt.c @@ -4482,7 +4482,7 @@ void DesEcbEncrypt(void *dst, void *src, void *key_7bytes) DES_cblock key; DES_key_schedule ks; // Validate arguments - if (dst == NULL || src == NULL || key == NULL) + if (dst == NULL || src == NULL || key_7bytes == NULL) { return; } diff --git a/src/Mayaqua/Network.c b/src/Mayaqua/Network.c index 41d69cce..5d36dc9f 100644 --- a/src/Mayaqua/Network.c +++ b/src/Mayaqua/Network.c @@ -13490,7 +13490,7 @@ UINT SecureRecv(SOCK *sock, void *data, UINT size) UINT SecureSend(SOCK *sock, void *data, UINT size) { SOCKET s; - int ret, e; + int ret, e = SSL_ERROR_NONE; SSL *ssl; s = sock->socket; ssl = sock->ssl;