|
From: stipa (C. Review) <ge...@op...> - 2025-10-30 10:09:40
|
Attention is currently required from: flichtenheld, plaisthos.
Hello plaisthos, flichtenheld,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1332?usp=email
to review the following change.
Change subject: win32: ensure plugin dir has the trailing slash
......................................................................
win32: ensure plugin dir has the trailing slash
This prevents loading plugins from the directories
which share initial characters with the trusted path.
Reported-by: Joshua Rogers <co...@jo...>
Found-by: ZeroPath (https://zeropath.com/)
Change-Id: I5ea90594493ab5cb858f7495f773e080b379e8e8
Signed-off-by: Lev Stipakov <le...@op...>
---
M CMakeLists.txt
M src/openvpn/win32.c
2 files changed, 29 insertions(+), 11 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/32/1332/1
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c9301e6..6888de3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -245,6 +245,9 @@
check_symbol_exists(chsize io.h HAVE_CHSIZE)
check_symbol_exists(getrlimit sys/resource.h HAVE_GETRLIMIT)
+# Some old versions of mingw does not have PATHCCH_OPTIONS enums -- add a check
+check_symbol_exists(PATHCCH_ENSURE_TRAILING_SLASH pathcch.h HAVE_PATHCCH_ENSURE_TRAILING_SLASH)
+
# Some OS (e.g. FreeBSD) need some basic headers to allow
# including network headers
set(NETEXTRA sys/types.h)
@@ -338,7 +341,7 @@
if (WIN32)
target_link_libraries(${target} PUBLIC
ws2_32.lib crypt32.lib fwpuclnt.lib iphlpapi.lib
- wininet.lib setupapi.lib rpcrt4.lib wtsapi32.lib ncrypt.lib bcrypt.lib)
+ wininet.lib setupapi.lib rpcrt4.lib wtsapi32.lib ncrypt.lib bcrypt.lib pathcch.lib)
endif ()
endif ()
diff --git a/src/openvpn/win32.c b/src/openvpn/win32.c
index 3c11ec3..6aa9463 100644
--- a/src/openvpn/win32.c
+++ b/src/openvpn/win32.c
@@ -51,6 +51,12 @@
#include "wfp_block.h"
+#include <pathcch.h>
+
+#ifndef HAVE_PATHCCH_ENSURE_TRAILING_SLASH
+#define PATHCCH_ENSURE_TRAILING_SLASH 0x20
+#endif
+
/*
* WFP handle
*/
@@ -1552,12 +1558,12 @@
return false;
}
- WCHAR plugin_dir[MAX_PATH] = { 0 };
+ WCHAR plugin_dir_reg[MAX_PATH] = { 0 };
/* Attempt to retrieve the trusted plugin directory path from the registry,
* using installation path as a fallback */
- if (!get_openvpn_reg_value(L"plugin_dir", plugin_dir, _countof(plugin_dir))
- && !get_openvpn_reg_value(NULL, plugin_dir, _countof(plugin_dir)))
+ if (!get_openvpn_reg_value(L"plugin_dir", plugin_dir_reg, _countof(plugin_dir_reg))
+ && !get_openvpn_reg_value(NULL, plugin_dir_reg, _countof(plugin_dir_reg)))
{
msg(M_WARN, "Installation path could not be determined.");
}
@@ -1569,26 +1575,35 @@
msg(M_NONFATAL | M_ERRNO, "Failed to get system directory.");
}
- if ((wcslen(plugin_dir) == 0) && (wcslen(system_dir) == 0))
+ if ((wcslen(plugin_dir_reg) == 0) && (wcslen(system_dir) == 0))
{
return false;
}
- WCHAR normalized_plugin_dir[MAX_PATH] = { 0 };
+ WCHAR plugin_dir[MAX_PATH] = { 0 };
- /* Normalize the plugin dir */
- if (wcslen(plugin_dir) > 0)
+ /* normalize and canonicalize the plugin dir and add trailing slash */
+ if (wcslen(plugin_dir_reg) > 0)
{
- if (!GetFullPathNameW(plugin_dir, MAX_PATH, normalized_plugin_dir, NULL))
+ WCHAR normalized_plugin_dir[MAX_PATH] = { 0 };
+ if (!GetFullPathNameW(plugin_dir_reg, MAX_PATH, normalized_plugin_dir, NULL))
{
msg(M_NONFATAL | M_ERRNO, "Failed to normalize plugin dir.");
+ }
+
+ HRESULT res = PathCchCanonicalizeEx(plugin_dir, _countof(plugin_dir), normalized_plugin_dir,
+ PATHCCH_ENSURE_TRAILING_SLASH);
+ if (res != S_OK)
+ {
+ /* doc says we cannot rely on GetLastError() */
+ msg(M_NONFATAL, "Failed to canonicalize plugin dir.");
return false;
}
}
/* Check if the plugin path resides within the plugin/install directory */
- if ((wcslen(normalized_plugin_dir) > 0)
- && (wcsnicmp(normalized_plugin_dir, plugin_path, wcslen(normalized_plugin_dir)) == 0))
+ if ((wcslen(plugin_dir) > 0)
+ && (wcsnicmp(plugin_dir, plugin_path, wcslen(plugin_dir)) == 0))
{
return true;
}
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1332?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I5ea90594493ab5cb858f7495f773e080b379e8e8
Gerrit-Change-Number: 1332
Gerrit-PatchSet: 1
Gerrit-Owner: stipa <lst...@gm...>
Gerrit-Reviewer: flichtenheld <fr...@li...>
Gerrit-Reviewer: plaisthos <arn...@rf...>
Gerrit-CC: openvpn-devel <ope...@li...>
Gerrit-Attention: plaisthos <arn...@rf...>
Gerrit-Attention: flichtenheld <fr...@li...>
|
|
From: cron2 (C. Review) <ge...@op...> - 2025-10-30 19:32:36
|
Attention is currently required from: flichtenheld, plaisthos, stipa. cron2 has posted comments on this change by stipa. ( http://gerrit.openvpn.net/c/openvpn/+/1332?usp=email ) Change subject: win32: ensure plugin dir has the trailing slash ...................................................................... Patch Set 1: Code-Review-2 (1 comment) Patchset: PS1: this breaks autoconf/automake compilation because the new library is not added to src/openvpn/Makefile.am ``` if WIN32 openvpn_SOURCES += openvpn_win32_resources.rc wfp_block.c wfp_block.h openvpn_LDADD += -lgdi32 -lws2_32 -lwininet -lcrypt32 -liphlpapi -lwinmm -lfwpuc lnt -lrpcrt4 -lncrypt -lsetupapi -lbcrypt endif ``` -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1332?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I5ea90594493ab5cb858f7495f773e080b379e8e8 Gerrit-Change-Number: 1332 Gerrit-PatchSet: 1 Gerrit-Owner: stipa <lst...@gm...> Gerrit-Reviewer: cron2 <ge...@gr...> Gerrit-Reviewer: flichtenheld <fr...@li...> Gerrit-Reviewer: plaisthos <arn...@rf...> Gerrit-CC: openvpn-devel <ope...@li...> Gerrit-Attention: plaisthos <arn...@rf...> Gerrit-Attention: flichtenheld <fr...@li...> Gerrit-Attention: stipa <lst...@gm...> Gerrit-Comment-Date: Thu, 30 Oct 2025 19:32:26 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes |
|
From: stipa (C. Review) <ge...@op...> - 2025-10-31 11:33:41
|
Attention is currently required from: flichtenheld, plaisthos, stipa.
Hello cron2, flichtenheld, plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1332?usp=email
to look at the new patch set (#2).
Change subject: win32: ensure plugin dir has the trailing slash
......................................................................
win32: ensure plugin dir has the trailing slash
This prevents loading plugins from the directories
which share initial characters with the trusted path.
Reported-by: Joshua Rogers <co...@jo...>
Found-by: ZeroPath (https://zeropath.com/)
Change-Id: I5ea90594493ab5cb858f7495f773e080b379e8e8
Signed-off-by: Lev Stipakov <le...@op...>
---
M CMakeLists.txt
M src/openvpn/Makefile.am
M src/openvpn/win32.c
3 files changed, 30 insertions(+), 12 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/32/1332/2
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c9301e6..6888de3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -245,6 +245,9 @@
check_symbol_exists(chsize io.h HAVE_CHSIZE)
check_symbol_exists(getrlimit sys/resource.h HAVE_GETRLIMIT)
+# Some old versions of mingw does not have PATHCCH_OPTIONS enums -- add a check
+check_symbol_exists(PATHCCH_ENSURE_TRAILING_SLASH pathcch.h HAVE_PATHCCH_ENSURE_TRAILING_SLASH)
+
# Some OS (e.g. FreeBSD) need some basic headers to allow
# including network headers
set(NETEXTRA sys/types.h)
@@ -338,7 +341,7 @@
if (WIN32)
target_link_libraries(${target} PUBLIC
ws2_32.lib crypt32.lib fwpuclnt.lib iphlpapi.lib
- wininet.lib setupapi.lib rpcrt4.lib wtsapi32.lib ncrypt.lib bcrypt.lib)
+ wininet.lib setupapi.lib rpcrt4.lib wtsapi32.lib ncrypt.lib bcrypt.lib pathcch.lib)
endif ()
endif ()
diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
index db87dfc..a2b5e92 100644
--- a/src/openvpn/Makefile.am
+++ b/src/openvpn/Makefile.am
@@ -166,5 +166,5 @@
$(OPTIONAL_INOTIFY_LIBS)
if WIN32
openvpn_SOURCES += openvpn_win32_resources.rc wfp_block.c wfp_block.h
-openvpn_LDADD += -lgdi32 -lws2_32 -lwininet -lcrypt32 -liphlpapi -lwinmm -lfwpuclnt -lrpcrt4 -lncrypt -lsetupapi -lbcrypt
+openvpn_LDADD += -lgdi32 -lws2_32 -lwininet -lcrypt32 -liphlpapi -lwinmm -lfwpuclnt -lrpcrt4 -lncrypt -lsetupapi -lbcrypt -lpathcch
endif
diff --git a/src/openvpn/win32.c b/src/openvpn/win32.c
index df29dd7..3ed28f6 100644
--- a/src/openvpn/win32.c
+++ b/src/openvpn/win32.c
@@ -51,6 +51,12 @@
#include "wfp_block.h"
+#include <pathcch.h>
+
+#ifndef HAVE_PATHCCH_ENSURE_TRAILING_SLASH
+#define PATHCCH_ENSURE_TRAILING_SLASH 0x20
+#endif
+
/*
* WFP handle
*/
@@ -1553,12 +1559,12 @@
return false;
}
- WCHAR plugin_dir[MAX_PATH] = { 0 };
+ WCHAR plugin_dir_reg[MAX_PATH] = { 0 };
/* Attempt to retrieve the trusted plugin directory path from the registry,
* using installation path as a fallback */
- if (!get_openvpn_reg_value(L"plugin_dir", plugin_dir, _countof(plugin_dir))
- && !get_openvpn_reg_value(NULL, plugin_dir, _countof(plugin_dir)))
+ if (!get_openvpn_reg_value(L"plugin_dir", plugin_dir_reg, _countof(plugin_dir_reg))
+ && !get_openvpn_reg_value(NULL, plugin_dir_reg, _countof(plugin_dir_reg)))
{
msg(M_WARN, "Installation path could not be determined.");
}
@@ -1570,26 +1576,35 @@
msg(M_NONFATAL | M_ERRNO, "Failed to get system directory.");
}
- if ((wcslen(plugin_dir) == 0) && (wcslen(system_dir) == 0))
+ if ((wcslen(plugin_dir_reg) == 0) && (wcslen(system_dir) == 0))
{
return false;
}
- WCHAR normalized_plugin_dir[MAX_PATH] = { 0 };
+ WCHAR plugin_dir[MAX_PATH] = { 0 };
- /* Normalize the plugin dir */
- if (wcslen(plugin_dir) > 0)
+ /* normalize and canonicalize the plugin dir and add trailing slash */
+ if (wcslen(plugin_dir_reg) > 0)
{
- if (!GetFullPathNameW(plugin_dir, MAX_PATH, normalized_plugin_dir, NULL))
+ WCHAR normalized_plugin_dir[MAX_PATH] = { 0 };
+ if (!GetFullPathNameW(plugin_dir_reg, MAX_PATH, normalized_plugin_dir, NULL))
{
msg(M_NONFATAL | M_ERRNO, "Failed to normalize plugin dir.");
+ }
+
+ HRESULT res = PathCchCanonicalizeEx(plugin_dir, _countof(plugin_dir), normalized_plugin_dir,
+ PATHCCH_ENSURE_TRAILING_SLASH);
+ if (res != S_OK)
+ {
+ /* doc says we cannot rely on GetLastError() */
+ msg(M_NONFATAL, "Failed to canonicalize plugin dir.");
return false;
}
}
/* Check if the plugin path resides within the plugin/install directory */
- if ((wcslen(normalized_plugin_dir) > 0)
- && (wcsnicmp(normalized_plugin_dir, plugin_path, wcslen(normalized_plugin_dir)) == 0))
+ if ((wcslen(plugin_dir) > 0)
+ && (wcsnicmp(plugin_dir, plugin_path, wcslen(plugin_dir)) == 0))
{
return true;
}
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1332?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I5ea90594493ab5cb858f7495f773e080b379e8e8
Gerrit-Change-Number: 1332
Gerrit-PatchSet: 2
Gerrit-Owner: stipa <lst...@gm...>
Gerrit-Reviewer: cron2 <ge...@gr...>
Gerrit-Reviewer: flichtenheld <fr...@li...>
Gerrit-Reviewer: plaisthos <arn...@rf...>
Gerrit-CC: openvpn-devel <ope...@li...>
Gerrit-Attention: plaisthos <arn...@rf...>
Gerrit-Attention: flichtenheld <fr...@li...>
Gerrit-Attention: stipa <lst...@gm...>
|
|
From: stipa (C. Review) <ge...@op...> - 2025-10-31 11:34:16
|
Attention is currently required from: cron2, flichtenheld, plaisthos. stipa has posted comments on this change by stipa. ( http://gerrit.openvpn.net/c/openvpn/+/1332?usp=email ) Change subject: win32: ensure plugin dir has the trailing slash ...................................................................... Patch Set 2: (2 comments) Patchset: PS1: > this breaks autoconf/automake compilation because the new library is not added to src/openvpn/Makefi […] Done Patchset: PS2: Fixed! -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1332?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I5ea90594493ab5cb858f7495f773e080b379e8e8 Gerrit-Change-Number: 1332 Gerrit-PatchSet: 2 Gerrit-Owner: stipa <lst...@gm...> Gerrit-Reviewer: cron2 <ge...@gr...> Gerrit-Reviewer: flichtenheld <fr...@li...> Gerrit-Reviewer: plaisthos <arn...@rf...> Gerrit-CC: openvpn-devel <ope...@li...> Gerrit-Attention: plaisthos <arn...@rf...> Gerrit-Attention: cron2 <ge...@gr...> Gerrit-Attention: flichtenheld <fr...@li...> Gerrit-Comment-Date: Fri, 31 Oct 2025 11:34:06 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: cron2 <ge...@gr...> |
|
From: cron2 (C. Review) <ge...@op...> - 2025-11-14 21:29:35
|
Attention is currently required from: flichtenheld, plaisthos, stipa. cron2 has posted comments on this change by stipa. ( http://gerrit.openvpn.net/c/openvpn/+/1332?usp=email ) Change subject: win32: ensure plugin dir has the trailing slash ...................................................................... Patch Set 2: Code-Review+2 -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1332?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I5ea90594493ab5cb858f7495f773e080b379e8e8 Gerrit-Change-Number: 1332 Gerrit-PatchSet: 2 Gerrit-Owner: stipa <lst...@gm...> Gerrit-Reviewer: cron2 <ge...@gr...> Gerrit-Reviewer: flichtenheld <fr...@li...> Gerrit-Reviewer: plaisthos <arn...@rf...> Gerrit-CC: openvpn-devel <ope...@li...> Gerrit-Attention: plaisthos <arn...@rf...> Gerrit-Attention: flichtenheld <fr...@li...> Gerrit-Attention: stipa <lst...@gm...> Gerrit-Comment-Date: Fri, 14 Nov 2025 21:29:20 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes |
|
From: Gert D. <ge...@gr...> - 2025-11-14 21:29:49
|
From: Lev Stipakov <le...@op...> This prevents loading plugins from the directories which share initial characters with the trusted path. Reported-by: Joshua Rogers <co...@jo...> Found-by: ZeroPath (https://zeropath.com/) Change-Id: I5ea90594493ab5cb858f7495f773e080b379e8e8 Signed-off-by: Lev Stipakov <le...@op...> Acked-by: Gert Doering <ge...@gr...> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1332 --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1332 This mail reflects revision 2 of this Change. Acked-by according to Gerrit (reflected above): Gert Doering <ge...@gr...> diff --git a/CMakeLists.txt b/CMakeLists.txt index c9301e6..6888de3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -245,6 +245,9 @@ check_symbol_exists(chsize io.h HAVE_CHSIZE) check_symbol_exists(getrlimit sys/resource.h HAVE_GETRLIMIT) +# Some old versions of mingw does not have PATHCCH_OPTIONS enums -- add a check +check_symbol_exists(PATHCCH_ENSURE_TRAILING_SLASH pathcch.h HAVE_PATHCCH_ENSURE_TRAILING_SLASH) + # Some OS (e.g. FreeBSD) need some basic headers to allow # including network headers set(NETEXTRA sys/types.h) @@ -338,7 +341,7 @@ if (WIN32) target_link_libraries(${target} PUBLIC ws2_32.lib crypt32.lib fwpuclnt.lib iphlpapi.lib - wininet.lib setupapi.lib rpcrt4.lib wtsapi32.lib ncrypt.lib bcrypt.lib) + wininet.lib setupapi.lib rpcrt4.lib wtsapi32.lib ncrypt.lib bcrypt.lib pathcch.lib) endif () endif () diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am index db87dfc..a2b5e92 100644 --- a/src/openvpn/Makefile.am +++ b/src/openvpn/Makefile.am @@ -166,5 +166,5 @@ $(OPTIONAL_INOTIFY_LIBS) if WIN32 openvpn_SOURCES += openvpn_win32_resources.rc wfp_block.c wfp_block.h -openvpn_LDADD += -lgdi32 -lws2_32 -lwininet -lcrypt32 -liphlpapi -lwinmm -lfwpuclnt -lrpcrt4 -lncrypt -lsetupapi -lbcrypt +openvpn_LDADD += -lgdi32 -lws2_32 -lwininet -lcrypt32 -liphlpapi -lwinmm -lfwpuclnt -lrpcrt4 -lncrypt -lsetupapi -lbcrypt -lpathcch endif diff --git a/src/openvpn/win32.c b/src/openvpn/win32.c index df29dd7..3ed28f6 100644 --- a/src/openvpn/win32.c +++ b/src/openvpn/win32.c @@ -51,6 +51,12 @@ #include "wfp_block.h" +#include <pathcch.h> + +#ifndef HAVE_PATHCCH_ENSURE_TRAILING_SLASH +#define PATHCCH_ENSURE_TRAILING_SLASH 0x20 +#endif + /* * WFP handle */ @@ -1553,12 +1559,12 @@ return false; } - WCHAR plugin_dir[MAX_PATH] = { 0 }; + WCHAR plugin_dir_reg[MAX_PATH] = { 0 }; /* Attempt to retrieve the trusted plugin directory path from the registry, * using installation path as a fallback */ - if (!get_openvpn_reg_value(L"plugin_dir", plugin_dir, _countof(plugin_dir)) - && !get_openvpn_reg_value(NULL, plugin_dir, _countof(plugin_dir))) + if (!get_openvpn_reg_value(L"plugin_dir", plugin_dir_reg, _countof(plugin_dir_reg)) + && !get_openvpn_reg_value(NULL, plugin_dir_reg, _countof(plugin_dir_reg))) { msg(M_WARN, "Installation path could not be determined."); } @@ -1570,26 +1576,35 @@ msg(M_NONFATAL | M_ERRNO, "Failed to get system directory."); } - if ((wcslen(plugin_dir) == 0) && (wcslen(system_dir) == 0)) + if ((wcslen(plugin_dir_reg) == 0) && (wcslen(system_dir) == 0)) { return false; } - WCHAR normalized_plugin_dir[MAX_PATH] = { 0 }; + WCHAR plugin_dir[MAX_PATH] = { 0 }; - /* Normalize the plugin dir */ - if (wcslen(plugin_dir) > 0) + /* normalize and canonicalize the plugin dir and add trailing slash */ + if (wcslen(plugin_dir_reg) > 0) { - if (!GetFullPathNameW(plugin_dir, MAX_PATH, normalized_plugin_dir, NULL)) + WCHAR normalized_plugin_dir[MAX_PATH] = { 0 }; + if (!GetFullPathNameW(plugin_dir_reg, MAX_PATH, normalized_plugin_dir, NULL)) { msg(M_NONFATAL | M_ERRNO, "Failed to normalize plugin dir."); + } + + HRESULT res = PathCchCanonicalizeEx(plugin_dir, _countof(plugin_dir), normalized_plugin_dir, + PATHCCH_ENSURE_TRAILING_SLASH); + if (res != S_OK) + { + /* doc says we cannot rely on GetLastError() */ + msg(M_NONFATAL, "Failed to canonicalize plugin dir."); return false; } } /* Check if the plugin path resides within the plugin/install directory */ - if ((wcslen(normalized_plugin_dir) > 0) - && (wcsnicmp(normalized_plugin_dir, plugin_path, wcslen(normalized_plugin_dir)) == 0)) + if ((wcslen(plugin_dir) > 0) + && (wcsnicmp(plugin_dir, plugin_path, wcslen(plugin_dir)) == 0)) { return true; } |
|
From: cron2 (C. Review) <ge...@op...> - 2025-11-15 16:49:42
|
Attention is currently required from: flichtenheld, plaisthos, stipa. cron2 has posted comments on this change by stipa. ( http://gerrit.openvpn.net/c/openvpn/+/1332?usp=email ) Change subject: win32: ensure plugin dir has the trailing slash ...................................................................... Patch Set 2: Code-Review-2 (1 comment) Patchset: PS2: This is a bit annoying, with the back and forth of `PATHCCH_ENSURE_TRAILING_SLASH` in the iservice, we actually lost the configure.ac block that tests for it again, in commit 763160a16a. So this can't go in as it is. So I do wonder if it makes more sense to have a manual check + `strcat()` on `normalized_plugin_dir` instead? Since this is already normalized via `GetFullPathNameW()`, bringing in the new API just for the last character really is a bit heavy... -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1332?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I5ea90594493ab5cb858f7495f773e080b379e8e8 Gerrit-Change-Number: 1332 Gerrit-PatchSet: 2 Gerrit-Owner: stipa <lst...@gm...> Gerrit-Reviewer: cron2 <ge...@gr...> Gerrit-Reviewer: flichtenheld <fr...@li...> Gerrit-Reviewer: plaisthos <arn...@rf...> Gerrit-CC: openvpn-devel <ope...@li...> Gerrit-Attention: plaisthos <arn...@rf...> Gerrit-Attention: flichtenheld <fr...@li...> Gerrit-Attention: stipa <lst...@gm...> Gerrit-Comment-Date: Sat, 15 Nov 2025 16:49:27 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes |
|
From: selvanair (C. Review) <ge...@op...> - 2025-11-15 17:17:09
|
Attention is currently required from: flichtenheld, plaisthos, stipa. selvanair has posted comments on this change by stipa. ( http://gerrit.openvpn.net/c/openvpn/+/1332?usp=email ) Change subject: win32: ensure plugin dir has the trailing slash ...................................................................... Patch Set 2: (2 comments) Patchset: PS2: > This is a bit annoying, with the back and forth of `PATHCCH_ENSURE_TRAILING_SLASH` in the iservice, […] A work around is to use PathCchAddBackslash() followed by PathCchCanonicalize() avoiding the dependence on the `PATHCCH_ENSURE_TRAILING_SLASH` flag. File src/openvpn/win32.c: http://gerrit.openvpn.net/c/openvpn/+/1332/comment/3384bb13_c17698f4?usp=email : PS2, Line 1607: && (wcsnicmp(plugin_dir, plugin_path, wcslen(plugin_dir)) == 0)) Is the logic right here? We are canonicalizing plugin_dir, but not plugin_path. Are we sure plugin_path cannot not contain "../"? The latter being user supplied, its more important to canonicalize it than the path read from HKLM. -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1332?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I5ea90594493ab5cb858f7495f773e080b379e8e8 Gerrit-Change-Number: 1332 Gerrit-PatchSet: 2 Gerrit-Owner: stipa <lst...@gm...> Gerrit-Reviewer: cron2 <ge...@gr...> Gerrit-Reviewer: flichtenheld <fr...@li...> Gerrit-Reviewer: plaisthos <arn...@rf...> Gerrit-CC: openvpn-devel <ope...@li...> Gerrit-CC: selvanair <sel...@gm...> Gerrit-Attention: plaisthos <arn...@rf...> Gerrit-Attention: flichtenheld <fr...@li...> Gerrit-Attention: stipa <lst...@gm...> Gerrit-Comment-Date: Sat, 15 Nov 2025 17:16:53 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: cron2 <ge...@gr...> |