Skip to content

Commit 5edb1be

Browse files
committed
fix server crash for STRALGO command
1 parent fe640e5 commit 5edb1be

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/t_string.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,15 +519,15 @@ void stralgoLCS(client *c) {
519519
!= C_OK) return;
520520
if (minmatchlen < 0) minmatchlen = 0;
521521
j++;
522-
} else if (!strcasecmp(opt,"STRINGS")) {
522+
} else if (!strcasecmp(opt,"STRINGS") && (c->argc-j) > 2) {
523523
if (a != NULL) {
524524
addReplyError(c,"Either use STRINGS or KEYS");
525525
return;
526526
}
527527
a = c->argv[j+1]->ptr;
528528
b = c->argv[j+2]->ptr;
529529
j += 2;
530-
} else if (!strcasecmp(opt,"KEYS")) {
530+
} else if (!strcasecmp(opt,"KEYS") && (c->argc-j) > 2) {
531531
if (a != NULL) {
532532
addReplyError(c,"Either use STRINGS or KEYS");
533533
return;

0 commit comments

Comments
 (0)