Gert Doering has submitted this change. ( 
https://gerrit.openvpn.net/c/openvpn/+/2111?usp=email )

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]>
Acked-by: Heiko Hund <[email protected]>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2111
Message-Id: <[email protected]>
URL: 
https://lore.kernel.org/openvpn-devel/[email protected]
Signed-off-by: Gert Doering <[email protected]>
---
M src/openvpnserv/interactive.c
1 file changed, 4 insertions(+), 2 deletions(-)




diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c
index 4a8d0b5..a04a449 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: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ifc707ef69d614c3408b6f88c780e337e95baafac
Gerrit-Change-Number: 2111
Gerrit-PatchSet: 2
Gerrit-Owner: Răzvan Cojocaru <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-Reviewer: Heiko Hund <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to