From d05217454f0af8d97836c5689bbfa0eb556025c7 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Fri, 7 Dec 2018 12:36:18 +0100 Subject: [PATCH] Fix #5115: Cast PEM data from BYTE* to char* to silence warnings. --- libfreerdp/crypto/tls.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libfreerdp/crypto/tls.c b/libfreerdp/crypto/tls.c index 6b1c72f..d4689cb 100644 --- a/libfreerdp/crypto/tls.c +++ b/libfreerdp/crypto/tls.c @@ -1192,20 +1192,24 @@ static BOOL is_accepted(rdpTls* tls, const BYTE* pem, size_t length) static BOOL accept_cert(rdpTls* tls, const BYTE* pem, UINT32 length) { rdpSettings* settings = tls->settings; + char* dupPem = _strdup((const char*) pem); + + if (!dupPem) + return FALSE; if (tls->isGatewayTransport) { - settings->GatewayAcceptedCert = _strdup(pem); + settings->GatewayAcceptedCert = dupPem; settings->GatewayAcceptedCertLength = length; } else if (is_redirected(tls)) { - settings->RedirectionAcceptedCert = _strdup(pem); + settings->RedirectionAcceptedCert = dupPem; settings->RedirectionAcceptedCertLength = length; } else { - settings->AcceptedCert = _strdup(pem); + settings->AcceptedCert = dupPem; settings->AcceptedCertLength = length; } -- 2.7.4