Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trap and report error when hostname is null/empty (uplift to 1.50.x) #17919

Merged
merged 1 commit into from
Apr 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions components/brave_vpn/browser/connection/win/utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,14 @@ RasOperationResult CreateEntry(const std::wstring& entry_name,
const std::wstring& hostname,
const std::wstring& username,
const std::wstring& password) {
// `RasSetEntryProperties` can have problems if fields are empty.
// Specifically, it will crash if `hostname` is NULL. Entry name
// is already validated.
if (hostname.empty()) {
VLOG(2) << __func__ << " Can't create entry with empty `hostname`";
return GetRasErrorResult("`hostname` is empty");
}

auto connection_result = CheckConnection(entry_name);
if (connection_result == CheckConnectionResult::CONNECTING ||
connection_result == CheckConnectionResult::CONNECTED) {
Expand Down