From 248a4da33125f53ee3b249a63d9d3e6057b4bd38 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Mon, 30 Apr 2018 21:18:56 -0700 Subject: [PATCH] Remove PEM_read* anti-pattern that only happens to work because we're using a global variable --- http.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/http.cpp b/http.cpp index d35372b..8f165d7 100644 --- a/http.cpp +++ b/http.cpp @@ -62,7 +62,7 @@ void MoonlightInstance::LoadCert(const char* certStr, const char* keyStr) BIO_free_all(bio); bio = BIO_new_mem_buf(_keyStr, -1); - if(PEM_read_bio_PrivateKey(bio, &g_PrivateKey, NULL, NULL) == NULL) { + if (!(g_PrivateKey = PEM_read_bio_PrivateKey(bio, NULL, NULL, NULL))) { PostMessage(pp::Var("Error loading private key into memory")); } BIO_free_all(bio);