From: Selva Nair <selva.n...@gmail.com>

- Currently a pointer to potentially uninitialized IP_ADAPTER_INFO
  struct is returned on error causing ill-defined behaviour.

Signed-off-by: Selva Nair <selva.n...@gmail.com>
---

There have been some reports of unexpected failure in GetAdaptersInfo.
When and why that happens is still unclear but this bug could explain
why the process goes into a tailspin in such occasions.

 src/openvpn/tun.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
index 25831ce..6e16348 100644
--- a/src/openvpn/tun.c
+++ b/src/openvpn/tun.c
@@ -4178,15 +4178,12 @@ get_adapter_info_list(struct gc_arena *gc)
     else
     {
         pi = (PIP_ADAPTER_INFO) gc_malloc(size, false, gc);
-        if ((status = GetAdaptersInfo(pi, &size)) == NO_ERROR)
-        {
-            return pi;
-        }
-        else
+        if ((status = GetAdaptersInfo(pi, &size)) != NO_ERROR)
         {
             msg(M_INFO, "GetAdaptersInfo #2 failed (status=%u) : %s",
                 (unsigned int)status,
                 strerror_win32(status, gc));
+            pi = NULL;
         }
     }
     return pi;
-- 
2.1.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to