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>
This commit is contained in:
parent
0b21ef8d49
commit
ae771ea77b
@ -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);
|
||||
|
@ -2890,8 +2890,11 @@ void RM_ReplySetSetLength(RedisModuleCtx *ctx, long len) {
|
||||
}
|
||||
|
||||
/* Very similar to RedisModule_ReplySetMapLength
|
||||
* Visit https://github.com/antirez/RESP3/blob/master/spec.md for more info about RESP3. */
|
||||
* Visit https://github.com/antirez/RESP3/blob/master/spec.md for more info about RESP3.
|
||||
*
|
||||
* Must not be called if RM_ReplyWithAttribute returned an error. */
|
||||
void RM_ReplySetAttributeLength(RedisModuleCtx *ctx, long len) {
|
||||
if (ctx->client->resp == 2) return;
|
||||
moduleReplySetCollectionLength(ctx, len, COLLECTION_REPLY_ATTRIBUTE);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user