This is an automated email from the ASF dual-hosted git repository.
hulk pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/kvrocks.git
The following commit(s) were added to refs/heads/unstable by this push:
new d839d163 Make INFO command reject cases with arguments greater than 2
(#1570)
d839d163 is described below
commit d839d163284a7cda61127a285587a489d243812e
Author: Binbin <[email protected]>
AuthorDate: Mon Jul 10 15:42:12 2023 +0800
Make INFO command reject cases with arguments greater than 2 (#1570)
Passing info a b c is the same as passing plain info
since we only checked that args_.size() == 2, by default it
will output all.
In this PR, we will reject args_.size() > 2 and return a
syntax error. This is consistent with Redis 6.2 behavior,
however, it is inconsistent with Redis 7.0, Redis 7.0 supports
passing info server clients...
Because we don't plan to do such support for the time being,
we will first fix the problematic parts.
---
src/commands/cmd_server.cc | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/commands/cmd_server.cc b/src/commands/cmd_server.cc
index 7a796aa3..e6f6f33b 100644
--- a/src/commands/cmd_server.cc
+++ b/src/commands/cmd_server.cc
@@ -267,6 +267,8 @@ class CommandInfo : public Commander {
std::string section = "all";
if (args_.size() == 2) {
section = util::ToLower(args_[1]);
+ } else if (args_.size() > 2) {
+ return {Status::RedisParseErr, errInvalidSyntax};
}
std::string info;
svr->GetInfo(conn->GetNamespace(), section, &info);