From b0323d894a4e4e84cd593bd592a46c3d81cc6f9a Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Fri, 5 Aug 2016 16:28:21 +0200 Subject: [PATCH] Issues with pre-shared credentials after being moved to heap fixed --- lib/EAPBase/src/Config.cpp | 4 ++-- lib/TTLS/src/Module.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/EAPBase/src/Config.cpp b/lib/EAPBase/src/Config.cpp index 3a94d0f..09d64a2 100644 --- a/lib/EAPBase/src/Config.cpp +++ b/lib/EAPBase/src/Config.cpp @@ -153,7 +153,7 @@ eap::config_method_with_cred::config_method_with_cred(_In_ module *mod) : eap::config_method_with_cred::config_method_with_cred(_In_ const config_method_with_cred &other) : m_allow_save(other.m_allow_save), m_use_preshared(other.m_use_preshared), - m_preshared((credentials*)other.m_preshared->clone()), + m_preshared(other.m_preshared ? (credentials*)other.m_preshared->clone() : nullptr), config_method(other) { } @@ -174,7 +174,7 @@ eap::config_method_with_cred& eap::config_method_with_cred::operator=(_In_ const (config_method&)*this = other; m_allow_save = other.m_allow_save; m_use_preshared = other.m_use_preshared; - m_preshared.reset((credentials*)other.m_preshared->clone()); + m_preshared.reset(other.m_preshared ? (credentials*)other.m_preshared->clone() : nullptr); } return *this; diff --git a/lib/TTLS/src/Module.cpp b/lib/TTLS/src/Module.cpp index 78c6faf..d681eef 100644 --- a/lib/TTLS/src/Module.cpp +++ b/lib/TTLS/src/Module.cpp @@ -136,7 +136,7 @@ bool eap::peer_ttls::get_identity( if (!is_outer_set && cfg_method->m_outer.m_use_preshared) { // Outer TLS: Using preshared credentials. - cred_out.m_outer = (credentials_tls&)cfg_method->m_outer.m_preshared; + cred_out.m_outer = *(credentials_tls*)cfg_method->m_outer.m_preshared.get(); log_event(&EAPMETHOD_TRACE_EVT_CRED_PRESHARED1, event_data((DWORD)eap_type_tls), event_data(cred_out.m_outer.get_name()), event_data::blank); is_outer_set = true; }