From e6099abe405e8bfdf9bd6b6500cebcda279bec8e Mon Sep 17 00:00:00 2001 From: Michael Clausen Date: Thu, 3 May 2018 23:31:07 +0200 Subject: [PATCH] Peer info optional in OvsParseKeyMethod2() (#355) * Peer info optional in OvsParseKeyMethod2() Some OpenVPN clients (MikroTik router for example) do not send the peer info along with the key exchange. This patch makes the peer info string optional on the SoftEtherVPN side. * Fixed indentation --- src/Cedar/Interop_OpenVPN.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Cedar/Interop_OpenVPN.c b/src/Cedar/Interop_OpenVPN.c index 3b344c97..366ce95f 100644 --- a/src/Cedar/Interop_OpenVPN.c +++ b/src/Cedar/Interop_OpenVPN.c @@ -1180,9 +1180,12 @@ UINT OvsParseKeyMethod2(OPENVPN_KEY_METHOD_2 *ret, UCHAR *data, UINT size, bool // 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))) - { + 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; } }