Gert Doering has uploaded a new patch set (#2) to the change originally created 
by Heiko Hund. ( https://gerrit.openvpn.net/c/openvpn/+/2039?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by Frank Lichtenheld


Change subject: plugin: detect too long plugin paths on Windows
......................................................................

plugin: detect too long plugin paths on Windows

GetFullPathNameW() returns the required buffer size if the normalized
path doesn't fit. This case is currently not checked, so a normalized
path longer than MAX_PATH left the buffer empty and the plugin was
then rejected with the misleading message that it is not located in
a trusted directory.

Treat a return value that does not fit into the buffer as failure, so
that the error says that the path could not be normalized. Since
GetFullPathNameW() sets no error code, set ERROR_FILENAME_EXCED_RANGE
manually before logging.

Change-Id: Ib40b439ad84a08fe6d5d4407da18ed78151327e7
Signed-off-by: Heiko Hund <[email protected]>
Acked-by: Frank Lichtenheld <[email protected]>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2039
Message-Id: <[email protected]>
URL: 
https://www.mail-archive.com/[email protected]/msg40215.html
Signed-off-by: Gert Doering <[email protected]>
---
M src/openvpn/plugin.c
1 file changed, 7 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/39/2039/2

diff --git a/src/openvpn/plugin.c b/src/openvpn/plugin.c
index a94f07b..9826510 100644
--- a/src/openvpn/plugin.c
+++ b/src/openvpn/plugin.c
@@ -284,8 +284,14 @@
     WCHAR *wpath = wide_string(p->so_pathname, &gc);
     WCHAR normalized_plugin_path[MAX_PATH] = { 0 };
     /* Normalize the plugin path, converting any relative paths to absolute 
paths. */
-    if (!GetFullPathNameW(wpath, MAX_PATH, normalized_plugin_path, NULL))
+    DWORD len = GetFullPathNameW(wpath, _countof(normalized_plugin_path), 
normalized_plugin_path, NULL);
+    if (len == 0 || len >= _countof(normalized_plugin_path))
     {
+        /* GetFullPathNameW() sets no error code if the buffer is too small */
+        if (len != 0)
+        {
+            SetLastError(ERROR_FILENAME_EXCED_RANGE);
+        }
         msg(M_ERR, "PLUGIN_INIT: could not load plugin DLL: %ls. Failed to 
normalize plugin path.",
             wpath);
     }

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

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib40b439ad84a08fe6d5d4407da18ed78151327e7
Gerrit-Change-Number: 2039
Gerrit-PatchSet: 2
Gerrit-Owner: Heiko Hund <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-Reviewer: Frank Lichtenheld <[email protected]>
Gerrit-Reviewer: Lev Stipakov <[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