From 99fa312079424823a58aa05895e32d01c71dbadd Mon Sep 17 00:00:00 2001 From: mingfang Date: Fri, 12 Feb 2021 10:27:24 +0800 Subject: [PATCH] libfreerdp: core: deep copy ServerCertificate --- libfreerdp/core/settings.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libfreerdp/core/settings.c b/libfreerdp/core/settings.c index d339ab1e9..7013d1fba 100644 --- a/libfreerdp/core/settings.c +++ b/libfreerdp/core/settings.c @@ -701,6 +701,17 @@ static BOOL freerdp_settings_int_buffer_copy(rdpSettings* _settings, const rdpSe _settings->ClientRandomLength = settings->ClientRandomLength; } + if (settings->ServerCertificateLength) + { + _settings->ServerCertificate = (BYTE*)malloc(settings->ServerCertificateLength); + + if (!_settings->ServerCertificate) + goto out_fail; + + CopyMemory(_settings->ServerCertificate, settings->ServerCertificate, _settings->ServerCertificateLength); + _settings->ServerCertificateLength = settings->ServerCertificateLength; + } + if (settings->RdpServerCertificate) { _settings->RdpServerCertificate = certificate_clone(settings->RdpServerCertificate);