Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-pcre2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
libvmod-pcre2
Commits
2b7b320c
Commit
2b7b320c
authored
Feb 24, 2017
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eliminate some repetition in the range checking for match() options
parent
2ab4f12c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
22 deletions
+14
-22
vmod_pcre2.c
src/vmod_pcre2.c
+14
-22
No files found.
src/vmod_pcre2.c
View file @
2b7b320c
...
...
@@ -445,28 +445,20 @@ vmod_regex_match(VRT_CTX, struct vmod_pcre2_regex *regex,
if
(
mctx_call
->
priv
==
NULL
)
{
pcre2_match_context
*
mctx
;
/* XXX DRY */
if
(
match_limit
<
0
||
match_limit
>
UINT32_MAX
)
{
VERR
(
ctx
,
"match_limit (%lld) out of range in "
"%s.match() (must be >= 0 and <= %"
PRIu32
")"
,
(
long
long
)
match_limit
,
regex
->
vcl_name
,
UINT32_MAX
);
return
0
;
}
if
(
offset_limit
<
0
||
offset_limit
>
UINT32_MAX
)
{
VERR
(
ctx
,
"offset_limit (%lld) out of range in "
"%s.match() (must be >= 0 and <= %"
PRIu32
")"
,
(
long
long
)
offset_limit
,
regex
->
vcl_name
,
UINT32_MAX
);
return
0
;
}
if
(
recursion_limit
<
0
||
recursion_limit
>
UINT32_MAX
)
{
VERR
(
ctx
,
"recursion_limit (%lld) out of range in "
"%s.match() (must be >= 0 and <= %"
PRIu32
")"
,
(
long
long
)
recursion_limit
,
regex
->
vcl_name
,
UINT32_MAX
);
return
0
;
}
#define CHECK_RANGE(limit) do { \
if ((limit) < 0 || (limit) > UINT32_MAX) { \
VERR(ctx, #limit " (%lld) out of range in " \
"%s.match() (must be >= 0 and <= %" \
PRIu32 ")", (long long)(limit), \
regex->vcl_name, UINT32_MAX); \
return 0; \
} \
} while(0)
CHECK_RANGE
(
match_limit
);
CHECK_RANGE
(
offset_limit
);
CHECK_RANGE
(
recursion_limit
);
#undef CHECK_RANGE
if
((
mctx
=
pcre2_match_context_create
(
NULL
))
==
NULL
)
{
VERRNOMEM
(
ctx
,
"creating match context in %s.match()"
,
...
...
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