# HG changeset patch # User Sebastien Jodogne # Date 1758653339 -7200 # Node ID 47f3bbac4ed497b85f89207d8420569b545fa42e # Parent c648a54cf67ce263d01f7d5c1392931a362141a5 fix bad allocations of strings on the stack in HttpServer diff -r c648a54cf67c -r 47f3bbac4ed4 OrthancFramework/Sources/HttpServer/HttpServer.cpp --- a/OrthancFramework/Sources/HttpServer/HttpServer.cpp Tue Sep 23 16:13:54 2025 +0200 +++ b/OrthancFramework/Sources/HttpServer/HttpServer.cpp Tue Sep 23 20:48:59 2025 +0200 @@ -1779,6 +1779,7 @@ Toolbox::JoinStrings(listeningPorts, addresses, ","); } + std::list dynamicStrings; std::vector options; // Set the TCP port for the HTTP server @@ -1827,8 +1828,9 @@ if (sslVerifyPeers_) { // Set the trusted client certificates (for X509 mutual authentication) + dynamicStrings.push_back(SystemToolbox::PathToUtf8(trustedClientCertificates_)); options.push_back("ssl_ca_file"); - options.push_back(SystemToolbox::PathToUtf8(trustedClientCertificates_).c_str()); + options.push_back(dynamicStrings.back().c_str()); } if (ssl_) @@ -1845,13 +1847,14 @@ } // Set the SSL certificate, if any + dynamicStrings.push_back(SystemToolbox::PathToUtf8(certificate_)); options.push_back("ssl_certificate"); - options.push_back(SystemToolbox::PathToUtf8(certificate_).c_str()); + options.push_back(dynamicStrings.back().c_str()); }; assert(options.size() % 2 == 0); options.push_back(NULL); - + #if MONGOOSE_USE_CALLBACKS == 0 pimpl_->context_ = mg_start(&Callback, this, &options[0]);