mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-11-21 20:01:46 +00:00
Free OpenSSL's buffers only where CVE-2024-4741 is fixed
Before 3.0.14, 3.1.6, 3.2.2 and 3.3.1, SSL_free_buffers() could free the read buffer while a record whose header had been read still waited for its body. A client can bring that about before its connection is parked, since writing a response peeks at the socket. Check the OpenSSL that runs, not the one built against.
This commit is contained in:
1 parent
7e32283df3
commit
114e3d0e46
2 files changed
+39
-3
No files matched your search
@@ -95,6 +95,9 @@ macos_ssl_trust_settings_result(CFArrayRef trust_settings);
|
||||
} // namespace impl
|
||||
#endif
|
||||
} // namespace tls
|
||||
namespace detail {
|
||||
bool ssl_free_buffers_is_safe(unsigned long version);
|
||||
} // namespace detail
|
||||
} // namespace httplib
|
||||
#endif
|
||||
|
||||
@@ -34445,6 +34448,22 @@ bool tls_get_ok(Client &cli) {
|
||||
|
||||
} // namespace parking_test
|
||||
|
||||
TEST(KeepAliveParkingTest, SslFreeBuffersOnlyWhereTheCveIsFixed) {
|
||||
struct {
|
||||
unsigned long version;
|
||||
bool safe;
|
||||
} cases[] = {
|
||||
{0x30000020UL, false}, {0x300000d0UL, false}, {0x300000e0UL, true},
|
||||
{0x300000f0UL, true}, {0x30100050UL, false}, {0x30100060UL, true},
|
||||
{0x30200010UL, false}, {0x30200020UL, true}, {0x30300000UL, false},
|
||||
{0x30300010UL, true}, {0x30400000UL, true}, {0x40000000UL, true},
|
||||
};
|
||||
for (const auto &c : cases) {
|
||||
EXPECT_EQ(c.safe, detail::ssl_free_buffers_is_safe(c.version))
|
||||
<< std::hex << c.version;
|
||||
}
|
||||
}
|
||||
|
||||
TEST(KeepAliveParkingTest, IdleTlsConnectionsDoNotHoldTheWorkers) {
|
||||
using namespace parking_test;
|
||||
SSLServer svr(SERVER_CERT_FILE, SERVER_PRIVATE_KEY_FILE);
|
||||
|
||||
Reference in new issue
Block a user