From 27c08c1edf2a089bc2a1721fa4206326830fa62e Mon Sep 17 00:00:00 2001 From: WerWolv Date: Thu, 13 Jan 2022 09:05:16 +0100 Subject: [PATCH] fix: SSL verification being broken due to a off-by-one error --- plugins/libimhex/source/helpers/net.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/libimhex/source/helpers/net.cpp b/plugins/libimhex/source/helpers/net.cpp index 7b304a466..288258e54 100644 --- a/plugins/libimhex/source/helpers/net.cpp +++ b/plugins/libimhex/source/helpers/net.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -56,7 +57,7 @@ namespace hex { mbedtls_x509_crt_init(&crt); auto cacert = romfs::get("cacert.pem"); - mbedtls_x509_crt_parse(&crt, reinterpret_cast(cacert.data()), cacert.size()); + mbedtls_x509_crt_parse(&crt, reinterpret_cast(cacert.data()), cacert.size() + 1); mbedtls_ssl_conf_ca_chain(cfg, &crt, nullptr); @@ -116,6 +117,8 @@ namespace hex { std::optional Net::execute() { CURLcode result = curl_easy_perform(this->m_ctx); + if (result != CURLE_OK) + log::error("Net request failed with error {}!", curl_easy_strerror(result)); s32 responseCode = 0; curl_easy_getinfo(this->m_ctx, CURLINFO_RESPONSE_CODE, &responseCode);