mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-09-21 17:08:12 +02:00
[EURO-FOSSA] Fix a vunerability from "Search on Internet" command
Restrict the usage of customized search engine on only "http://" or "https://" url schema to avoid whatever application can be launched via "Search on Internet" command.
This commit is contained in:
parent
5bcf55c59e
commit
b90be4a05b
@ -458,14 +458,16 @@ void Notepad_plus::command(int id)
|
|||||||
generic_string url;
|
generic_string url;
|
||||||
if (nppGui._searchEngineChoice == nppGui.se_custom)
|
if (nppGui._searchEngineChoice == nppGui.se_custom)
|
||||||
{
|
{
|
||||||
if (nppGui._searchEngineCustom.empty())
|
url = nppGui._searchEngineCustom;
|
||||||
|
remove_if(url.begin(), url.end(), isspace);
|
||||||
|
|
||||||
|
auto httpPos = url.find(TEXT("http://"));
|
||||||
|
auto httpsPos = url.find(TEXT("https://"));
|
||||||
|
|
||||||
|
if (url.empty() || (httpPos != 0 && httpsPos != 0)) // if string is not a url (for launching only browser)
|
||||||
{
|
{
|
||||||
url = TEXT("https://www.google.com/search?q=$(CURRENT_WORD)");
|
url = TEXT("https://www.google.com/search?q=$(CURRENT_WORD)");
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
url = nppGui._searchEngineCustom.c_str();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (nppGui._searchEngineChoice == nppGui.se_duckDuckGo)
|
else if (nppGui._searchEngineChoice == nppGui.se_duckDuckGo)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user