fix server crash for STRALGO command

This commit is contained in:
hwware 2020-05-21 17:30:36 -04:00 committed by antirez
parent e60f63a718
commit 5c70dab9fc

View File

@ -519,7 +519,7 @@ void stralgoLCS(client *c) {
!= C_OK) return;
if (minmatchlen < 0) minmatchlen = 0;
j++;
} else if (!strcasecmp(opt,"STRINGS")) {
} else if (!strcasecmp(opt,"STRINGS") && (c->argc-j) > 2) {
if (a != NULL) {
addReplyError(c,"Either use STRINGS or KEYS");
return;
@ -527,7 +527,7 @@ void stralgoLCS(client *c) {
a = c->argv[j+1]->ptr;
b = c->argv[j+2]->ptr;
j += 2;
} else if (!strcasecmp(opt,"KEYS")) {
} else if (!strcasecmp(opt,"KEYS") && (c->argc-j) > 2) {
if (a != NULL) {
addReplyError(c,"Either use STRINGS or KEYS");
return;