OpenVPN / OpenVPN/openvpn3

memory leak [ ssl handshake ]

Open
#307 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
1.2k
Forks
467
PR merge metrics
No merged PRs in 30d

Description

I used ChatGPT because I'm not good at English. Please understand.

A memory leak of 116 bytes occurs during SSL handshake.
The memory leak was resolved by modifying it as follows:

openvpn3/openvpn/openssl/bio/bio_memq_stream.hpp 
@@ -200,7 +200,9 @@

     static inline void free_bio_method()
     {
-        BIO_meth_free(memq_method);
+        if(memq_method != nullptr){
+            BIO_meth_free(memq_method);
+        }
         memq_method = nullptr;
     }
 }; // class bio_memq_internal
@@ -215,6 +217,11 @@
     bio_memq_internal::init_static();
 }

+inline void free_bio_method()
+{
+    bio_memq_internal::free_bio_method();
+}
+
 inline BIO_METHOD *BIO_s_memq(void)
 {
     return (bio_memq_internal::memq_method);
openvpn3/openvpn/common/stop.hpp
@@ -83,6 +83,10 @@
     {
     }

+    ~Stop(){
+        bmq_stream::free_bio_method();
+    }
+
     void stop()
     {
         std::lock_guard<std::recursive_mutex> lock(mutex);

Please review.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with openvpn3/openvpn/openssl/bio/bio_memq_stream.hpp, focusing on bio_memq_internal::free_bio_method(), then inspect the Stop lifecycle in openvpn3/openvpn/common/stop.hpp. Reproduce or measure the reported 116-byte leak during an SSL handshake and verify that cleanup is performed safely without introducing lifecycle regressions.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
networking, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.