diff options
| author | Odd Stranne <odd@mullvad.net> | 2020-02-18 21:48:29 +0100 |
|---|---|---|
| committer | Odd Stranne <odd@mullvad.net> | 2020-02-19 21:36:04 +0100 |
| commit | a4cf19266db57268d0064b40593bf9efa623ca23 (patch) | |
| tree | 900f5027272c343ea63a6087f1f6591407b8ed23 | |
| parent | 95334814183aad5dd7121f73019459bf8be8242b (diff) | |
| download | mullvadvpn-a4cf19266db57268d0064b40593bf9efa623ca23.tar.xz mullvadvpn-a4cf19266db57268d0064b40593bf9efa623ca23.zip | |
WINDNS: Add parameter validation on public functions
| -rw-r--r-- | windows/windns/src/windns/windns.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/windows/windns/src/windns/windns.cpp b/windows/windns/src/windns/windns.cpp index 26e891521d..72db7a00b8 100644 --- a/windows/windns/src/windns/windns.cpp +++ b/windows/windns/src/windns/windns.cpp @@ -255,6 +255,12 @@ WinDns_Set( return false; } + if (nullptr == interfaceAlias) + { + g_LogSink->error("Invalid argument: interfaceAlias"); + return false; + } + // // Check the settings on the adapter. // If it already has the exact same settings we need, we're done. @@ -277,12 +283,12 @@ WinDns_Set( return true; } } - catch (const std::exception & ex) + catch (const std::exception &err) { std::stringstream ss; ss << "Failed to evaluate DNS settings on adapter with alias \"" - << common::string::ToAnsi(interfaceAlias) << "\": " << ex.what(); + << common::string::ToAnsi(interfaceAlias) << "\": " << err.what(); g_LogSink->info(ss.str().c_str()); } |
