mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
stringmatchlen() should not expect null terminated strings.
This commit is contained in:
parent
2e2f57e23b
commit
e17f9311c8
@ -51,7 +51,7 @@ int stringmatchlen(const char *pattern, int patternLen,
|
||||
while(patternLen && stringLen) {
|
||||
switch(pattern[0]) {
|
||||
case '*':
|
||||
while (pattern[1] == '*') {
|
||||
while (patternLen && pattern[1] == '*') {
|
||||
pattern++;
|
||||
patternLen--;
|
||||
}
|
||||
@ -94,7 +94,7 @@ int stringmatchlen(const char *pattern, int patternLen,
|
||||
pattern--;
|
||||
patternLen++;
|
||||
break;
|
||||
} else if (pattern[1] == '-' && patternLen >= 3) {
|
||||
} else if (patternLen >= 3 && pattern[1] == '-') {
|
||||
int start = pattern[0];
|
||||
int end = pattern[2];
|
||||
int c = string[0];
|
||||
|
Loading…
Reference in New Issue
Block a user