Attention is currently required from: Arne Schwabe.

Hello Arne Schwabe,

I'd like you to do a code review.
Please visit

    https://gerrit.openvpn.net/c/openvpn/+/2111?usp=email

to review the following change.


Change subject: openvpnserv: free security descriptors in RunOpenvpn()
......................................................................

openvpnserv: free security descriptors in RunOpenvpn()

The DACL from SetEntriesInAcl() and the pipe security descriptor from
ConvertStringSecurityDescriptorToSecurityDescriptorW() were never
freed, leaking both on every client connection. Initialize them to
NULL at the top and LocalFree() them at out.

DACL leaked since a24dd2e3 ("interactive service v3"), pipe security
descriptor since 0a429cb1 ("Restrict access to the service pipe to
SYSTEM and owner").

Change-Id: Ifc707ef69d614c3408b6f88c780e337e95baafac
Signed-off-by: Razvan Cojocaru <[email protected]>
---
M src/openvpnserv/interactive.c
1 file changed, 4 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/11/2111/1

diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c
index 484f27c..4ddc354 100644
--- a/src/openvpnserv/interactive.c
+++ b/src/openvpnserv/interactive.c
@@ -3444,7 +3444,8 @@
                                         .lpSecurityDescriptor = NULL,
                                         .bInheritHandle = TRUE };

-    PACL ovpn_dacl;
+    PACL ovpn_dacl = NULL;
+    PSECURITY_DESCRIPTOR pSD = NULL;
     EXPLICIT_ACCESS ea[2];
     SECURITY_DESCRIPTOR ovpn_sd;
     SECURITY_ATTRIBUTES ovpn_sa = { .nLength = sizeof(ovpn_sa),
@@ -3624,7 +3625,6 @@
      */

     SECURITY_ATTRIBUTES sa;
-    PSECURITY_DESCRIPTOR pSD = NULL;
     LPCWSTR szSDDL = L"D:(A;;GA;;;SY)(A;;GA;;;OW)";
     if (!ConvertStringSecurityDescriptorToSecurityDescriptorW(
             szSDDL, SDDL_REVISION_1, &pSD, NULL))
@@ -3764,6 +3764,8 @@
     free(ovpn_user);
     free(svc_user);
     free(cmdline);
+    LocalFree(pSD);
+    LocalFree(ovpn_dacl);
     DestroyEnvironmentBlock(user_env);
     FreeStartupData(&sud);
     CloseHandleEx(&proc_info.hProcess);

--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2111?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ifc707ef69d614c3408b6f88c780e337e95baafac
Gerrit-Change-Number: 2111
Gerrit-PatchSet: 1
Gerrit-Owner: Răzvan Cojocaru <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: Arne Schwabe <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to