Commit f339a53e authored by Max Kellermann's avatar Max Kellermann

client/Process: move basic syntax check to the beginning of method

This catches lines within command lists as well.
parent d9117a27
......@@ -55,6 +55,16 @@ Client::ProcessCommandList(bool list_ok,
CommandResult
Client::ProcessLine(char *line) noexcept
{
if (IsUpperAlphaASCII(*line)) {
/* no valid MPD command begins with an upper case
letter; this could be a badly routed HTTP
request */
FormatWarning(client_domain,
"[%u] malformed command \"%s\"",
num, line);
return CommandResult::CLOSE;
}
CommandResult ret;
if (StringIsEqual(line, "noidle")) {
......@@ -119,14 +129,6 @@ Client::ProcessLine(char *line) noexcept
} else if (StringIsEqual(line, CLIENT_LIST_OK_MODE_BEGIN)) {
cmd_list.Begin(true);
ret = CommandResult::OK;
} else if (IsUpperAlphaASCII(*line)) {
/* no valid MPD command begins with an upper
case letter; this could be a badly routed
HTTP request */
FormatWarning(client_domain,
"[%u] malformed command \"%s\"",
num, line);
ret = CommandResult::CLOSE;
} else {
FormatDebug(client_domain,
"[%u] process command \"%s\"",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment