stringmatchlen() should not expect null terminated strings.
This commit is contained in:
parent
24e12641d5
commit
3672875b4c
@ -51,7 +51,7 @@ int stringmatchlen(const char *pattern, int patternLen,
|
|||||||
while(patternLen && stringLen) {
|
while(patternLen && stringLen) {
|
||||||
switch(pattern[0]) {
|
switch(pattern[0]) {
|
||||||
case '*':
|
case '*':
|
||||||
while (pattern[1] == '*') {
|
while (patternLen && pattern[1] == '*') {
|
||||||
pattern++;
|
pattern++;
|
||||||
patternLen--;
|
patternLen--;
|
||||||
}
|
}
|
||||||
@ -94,7 +94,7 @@ int stringmatchlen(const char *pattern, int patternLen,
|
|||||||
pattern--;
|
pattern--;
|
||||||
patternLen++;
|
patternLen++;
|
||||||
break;
|
break;
|
||||||
} else if (pattern[1] == '-' && patternLen >= 3) {
|
} else if (patternLen >= 3 && pattern[1] == '-') {
|
||||||
int start = pattern[0];
|
int start = pattern[0];
|
||||||
int end = pattern[2];
|
int end = pattern[2];
|
||||||
int c = string[0];
|
int c = string[0];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user