From 462840cf6effdb35179664e4b4c95f9325bc1d73 Mon Sep 17 00:00:00 2001 From: Michael Clausen Date: Mon, 3 Oct 2016 13:31:03 +0200 Subject: [PATCH 1/2] Using client parameter in function CtConnect Using the global client variable might lead to strange behavoir if multiple clients are allocated and to crashes in the case the client was not initialized with CtStartClient() --- src/Cedar/Client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cedar/Client.c b/src/Cedar/Client.c index d4dd39be..9c907ff7 100644 --- a/src/Cedar/Client.c +++ b/src/Cedar/Client.c @@ -6661,7 +6661,7 @@ bool CtConnect(CLIENT *c, RPC_CLIENT_CONNECT *connect) CiSetError(c, ERR_ACCOUNT_ACTIVE); } else if (r->ClientAuth->AuthType == CLIENT_AUTHTYPE_SECURE && - client->UseSecureDeviceId == 0) + c->UseSecureDeviceId == 0) { // Secure device is not specified CiSetError(c, ERR_NO_SECURE_DEVICE_SPECIFIED); From 78bcc07fa9cbbcaff21c8fad95eac52174c8cbb3 Mon Sep 17 00:00:00 2001 From: cm0x4d Date: Thu, 28 Sep 2017 10:37:24 +0200 Subject: [PATCH 2/2] Peer info optional in OvsParseKeyMethod2() --- src/Cedar/Interop_OpenVPN.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/Cedar/Interop_OpenVPN.c b/src/Cedar/Interop_OpenVPN.c index 801f48b9..1eb57f82 100644 --- a/src/Cedar/Interop_OpenVPN.c +++ b/src/Cedar/Interop_OpenVPN.c @@ -1151,14 +1151,17 @@ UINT OvsParseKeyMethod2(OPENVPN_KEY_METHOD_2 *ret, UCHAR *data, UINT size, bool // Random2 if (ReadBuf(b, ret->Random2, sizeof(ret->Random2)) == sizeof(ret->Random2)) { - // String - if (OvsReadStringFromBuf(b, ret->OptionString, sizeof(ret->OptionString)) && - OvsReadStringFromBuf(b, ret->Username, sizeof(ret->Username)) && - OvsReadStringFromBuf(b, ret->Password, sizeof(ret->Password)) && - OvsReadStringFromBuf(b, ret->PeerInfo, sizeof(ret->PeerInfo))) - { - read_size = b->Current; - } + // String + if (OvsReadStringFromBuf(b, ret->OptionString, sizeof(ret->OptionString)) && + OvsReadStringFromBuf(b, ret->Username, sizeof(ret->Username)) && + OvsReadStringFromBuf(b, ret->Password, sizeof(ret->Password))) + { + if (!OvsReadStringFromBuf(b, ret->PeerInfo, sizeof(ret->PeerInfo))) + { + Zero(ret->PeerInfo, sizeof(ret->PeerInfo)); + } + read_size = b->Current; + } } } }