Prevent off-by-one read in stringmatchlen() (fixes #4527)

This commit is contained in:
nashe 2017-12-12 01:25:03 +01:00
parent 522760fac7
commit f43eb5adcf

View File

@ -84,7 +84,7 @@ int stringmatchlen(const char *pattern, int patternLen,
} }
match = 0; match = 0;
while(1) { while(1) {
if (pattern[0] == '\\') { if (pattern[0] == '\\' && patternLen >= 2) {
pattern++; pattern++;
patternLen--; patternLen--;
if (pattern[0] == string[0]) if (pattern[0] == string[0])