Skip to content

fix(logmonitor): allow absolute /Config paths again - #232

Open
Bob Sira (bobsira) wants to merge 1 commit into
mainfrom
fix/logmonitor-config-absolute-path-229
Open

fix(logmonitor): allow absolute /Config paths again#232
Bob Sira (bobsira) wants to merge 1 commit into
mainfrom
fix/logmonitor-config-absolute-path-229

Conversation

@bobsira

Copy link
Copy Markdown
Contributor

Restore support for absolute config paths while preserving relative path hardening for /Config.

Fixes regression introduced in 2.2.0 (issue #229 ).

Restore support for absolute config paths while preserving relative path hardening for /Config.

Fixes regression introduced in 2.2.0 (issue #229).
@bobsira
Bob Sira (bobsira) requested a lite review from Copilot August 6, 2026 17:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Restores support for absolute /Config paths while keeping the hardening that forces relative config file names to be resolved under the executable directory (regression from 2.2.0 / issue #229).

Changes:

  • Added ResolveConfigPath() helper to centralize config path validation + resolution behavior.
  • Updated /Config handling in wmain to use ResolveConfigPath() and remove duplicated logic.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +270 to +277
WCHAR modulePath[MAX_PATH] = {};
if (GetModuleFileNameW(nullptr, modulePath, _countof(modulePath)) == 0)
{
logWriter.TraceError(
Utility::FormatString(L"Failed to get module path. Error: %d", GetLastError()).c_str()
);
return false;
}
Comment on lines +254 to +259
// Preserve support for absolute paths passed via /Config.
if (!PathIsRelativeW(userConfigName.c_str()))
{
resolvedConfigPath = userConfigName;
return true;
}
Comment on lines +262 to +268
if (userConfigName.find(L"..") != std::wstring::npos ||
userConfigName.find(L'/') != std::wstring::npos ||
userConfigName.find(L'\\') != std::wstring::npos ||
userConfigName.find(L':') != std::wstring::npos)
{
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants