diff options
author | DarrenJiang13 <yjjiang1996@163.com> | 2022-03-28 16:54:34 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-28 11:54:34 +0300 |
commit | ae771ea77b1eb7b55444fd6189d9db77cb724990 (patch) | |
tree | 86fcb74cd6952774609eb9c3ee9354e2e0d2513e /src/debug.c | |
parent | 0b21ef8d49c47a5dd47a0bcc0cf1b2c235f24fd0 (diff) | |
download | redis-ae771ea77b1eb7b55444fd6189d9db77cb724990.tar.gz |
fix crash in debug protocol push (#10483)
a missing of resp3 judgement which may lead to the crash using `debug protocol push`
introduced in #9235
Similar improvement in RM_ReplySetAttributeLength in case the module ignored the
error that returned from RM_ReplyWithAttribute.
Co-authored-by: Oran Agra <oran@redislabs.com>
Diffstat (limited to 'src/debug.c')
-rw-r--r-- | src/debug.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/debug.c b/src/debug.c index 5d32ef0bc..4f0e37777 100644 --- a/src/debug.c +++ b/src/debug.c @@ -795,6 +795,10 @@ NULL * also have a normal reply type after the attribute. */ addReplyBulkCString(c,"Some real reply following the attribute"); } else if (!strcasecmp(name,"push")) { + if (c->resp < 3) { + addReplyError(c,"RESP2 is not supported by this command"); + return; + } addReplyPushLen(c,2); addReplyBulkCString(c,"server-cpu-usage"); addReplyLongLong(c,42); |