summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authornashe <thomas@chauchefoin.fr>2017-12-12 01:25:03 +0100
committernashe <thomas@chauchefoin.fr>2017-12-12 01:25:03 +0100
commitf43eb5adcfa3be6368f116656348a29f22f580eb (patch)
treef5fb6fb975f1b73b5dab62e154390d8b64032bd4 /src/util.c
parent522760fac79536eb68dc5fc70e9166f689eb76dc (diff)
downloadredis-f43eb5adcfa3be6368f116656348a29f22f580eb.tar.gz
Prevent off-by-one read in stringmatchlen() (fixes #4527)
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/util.c b/src/util.c
index 8d68f0bb1..36cbc43d3 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])