Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
e17f9311
Commit
e17f9311
authored
May 06, 2020
by
antirez
Browse files
stringmatchlen() should not expect null terminated strings.
parent
2e2f57e2
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/util.c
View file @
e17f9311
...
@@ -51,7 +51,7 @@ int stringmatchlen(const char *pattern, int patternLen,
...
@@ -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,
...
@@ -94,7 +94,7 @@ int stringmatchlen(const char *pattern, int patternLen,
pattern
--
;
pattern
--
;
patternLen
++
;
patternLen
++
;
break
;
break
;
}
else
if
(
pattern
[
1
]
==
'-'
&&
pattern
Len
>=
3
)
{
}
else
if
(
pattern
Len
>=
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
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment