fix: fix su's lexer

This commit is contained in:
2023-12-14 04:18:29 +00:00
parent 4cfbbc2991
commit 2628177746
2 changed files with 3 additions and 1 deletions

View File

@ -18,7 +18,7 @@
bool CommandSuLexer(const std::string &command, std::string &user_id,
std::string &password) {
static std::basic_regex main_pattern(
R"(^ *su +(?:[0-9a-zA-Z_]{1,30}) +(?:[0-9a-zA-Z_]{1,30})? *$)",
R"(^ *su +(?:[0-9a-zA-Z_]{1,30})(?: +[0-9a-zA-Z_]{1,30})? *$)",
std::regex_constants::optimize);
if (std::regex_match(command, main_pattern)) {
std::stringstream ss(command);