Mercurial > hg > orthanc
changeset 6327:47f3bbac4ed4
fix bad allocations of strings on the stack in HttpServer
| author | Sebastien Jodogne <s.jodogne@gmail.com> |
|---|---|
| date | Tue, 23 Sep 2025 20:48:59 +0200 |
| parents | c648a54cf67c |
| children | 5ea89eb7ba8f |
| files | OrthancFramework/Sources/HttpServer/HttpServer.cpp |
| diffstat | 1 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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<std::string> dynamicStrings; std::vector<const char*> 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]);
