Skip to content

Commit d467486

Browse files
committed
fix: safer regex
this also limits the protocol to http / https
1 parent a26b79c commit d467486

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/Features/ConfigPlus.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ CON_COMMAND_F(sar_download_file, "sar_download_file <url> <filepath> [directory]
6161
}
6262
if (!args[1][0] || !args[2][0]) return console->Print(sar_download_file.ThisPtr()->m_pszHelpString);
6363

64-
std::string domain = std::regex_replace(args[1], std::regex("^.*://([^/?:]+)/?.*$"), "$1");
64+
std::string domain = std::regex_replace(args[1], std::regex("^[htps]*://([^/?:]+)/?.*$"), "$1");
6565

6666
if (!strcmp(domain.c_str(), args[1])) return console->Print("Invalid URL.\n"); // URL is missing protocol. Reject.
6767

0 commit comments

Comments
 (0)