Skip to content

Commit

Permalink
Trap and report error when hostname is null/empty (uplift to 1.50.x) (#…
Browse files Browse the repository at this point in the history
…17919)

Trap and report error when hostname is null/empty

Fixes brave/brave-browser#28940
Fixes brave/brave-browser#29502
Fixes brave/brave-browser#29477
  • Loading branch information
bsclifton authored Apr 5, 2023
1 parent 1994469 commit 4379740
Showing 1 changed file with 8 additions and 0 deletions.
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

0 comments on commit 4379740

Please sign in to comment.