From f43eb5adcfa3be6368f116656348a29f22f580eb Mon Sep 17 00:00:00 2001 From: nashe Date: Tue, 12 Dec 2017 01:25:03 +0100 Subject: [PATCH] Prevent off-by-one read in stringmatchlen() (fixes #4527) --- src/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util.c b/src/util.c index 8d68f0bb..36cbc43d 100644 --- a/src/util.c +++ b/src/util.c @@ -84,7 +84,7 @@ int stringmatchlen(const char *pattern, int patternLen, } match = 0; while(1) { - if (pattern[0] == '\\') { + if (pattern[0] == '\\' && patternLen >= 2) { pattern++; patternLen--; if (pattern[0] == string[0])