Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
d17b8129
Commit
d17b8129
authored
Jul 28, 2017
by
Federico G. Schwindt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Limit the number of fields up to 255
Part of #2344.
parent
3457dedc
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
15 deletions
+11
-15
varnishncsa.c
bin/varnishncsa/varnishncsa.c
+6
-11
u00003.vtc
bin/varnishtest/tests/u00003.vtc
+3
-3
varnishncsa.rst
doc/sphinx/reference/varnishncsa.rst
+2
-1
No files found.
bin/varnishncsa/varnishncsa.c
View file @
d17b8129
...
...
@@ -591,8 +591,8 @@ static void
parse_x_format
(
char
*
buf
)
{
char
*
e
,
*
r
,
*
s
;
long
lval
;
int
slt
;
intmax_t
i
;
if
(
!
strcmp
(
buf
,
"Varnish:time_firstbyte"
))
{
addf_fragment
(
&
CTX
.
frag
[
F_ttfb
],
""
);
...
...
@@ -632,23 +632,18 @@ parse_x_format(char *buf)
if
(
r
==
buf
||
r
[
1
]
==
']'
)
VUT_Error
(
1
,
"Syntax error: VSL:%s"
,
buf
);
e
[
-
1
]
=
'\0'
;
i
=
strtoimax
(
r
+
1
,
&
s
,
10
);
lval
=
strtol
(
r
+
1
,
&
s
,
10
);
if
(
s
!=
e
-
1
)
VUT_Error
(
1
,
"Syntax error: VSL:%s]"
,
buf
);
if
(
i
<=
0
)
if
(
lval
<=
0
||
lval
>
255
)
{
VUT_Error
(
1
,
"Syntax error. Field specifier must be"
"
positive
: %s]"
,
"
between 1 and 255
: %s]"
,
buf
);
if
(
i
>
INT_MAX
)
{
VUT_Error
(
1
,
"Field specifier %jd for the tag VSL:%s]"
" is probably too high"
,
i
,
buf
);
}
*
r
=
'\0'
;
}
else
i
=
0
;
lval
=
0
;
r
=
buf
;
while
(
r
<
e
&&
*
r
!=
':'
)
r
++
;
...
...
@@ -665,7 +660,7 @@ parse_x_format(char *buf)
VUT_Error
(
1
,
"Unknown log tag: %s"
,
buf
);
assert
(
slt
>=
0
);
addf_vsl
(
slt
,
i
,
r
);
addf_vsl
(
slt
,
lval
,
r
);
return
;
}
VUT_Error
(
1
,
"Unknown formatting extension: %s"
,
buf
);
...
...
bin/varnishtest/tests/u00003.vtc
View file @
d17b8129
...
...
@@ -90,10 +90,10 @@ shell -err -expect "Unknown log tag: Begin[a" \
shell -err -expect "Syntax error: VSL:Begin[a]" \
{varnishncsa -F "%{VSL:Begin[a]}x"}
shell -err -match {Syntax error. (?#
)Field specifier must be
positive
: Begin\[0\]} \
)Field specifier must be
between 1 and 255
: Begin\[0\]} \
{varnishncsa -F "%{VSL:Begin[0]}x"}
shell -err -match {
Field specifier 999999999999 for the tag
(?#
)
VSL:Begin\[999999999999\] is probably too high
} \
shell -err -match {
Syntax error.
(?#
)
Field specifier must be between 1 and 255: Begin\[999999999999\]
} \
{varnishncsa -F "%{VSL:Begin[999999999999]}x"}
shell -err -expect "Can't open format file (No such file or directory)" \
{varnishncsa -f /nonexistent/file}
...
...
doc/sphinx/reference/varnishncsa.rst
View file @
d17b8129
...
...
@@ -184,7 +184,8 @@ Supported formatters are:
The field will, if present, treat the log record as a white
space separated list of fields, and only the nth part of the
record will be matched against. Fields start counting at 1.
record will be matched against. Fields start counting at 1 and
run up to 255.
Defaults to '-' when the tag is not seen, the record prefix
does not match or the field is out of bounds. If a tag appears
...
...
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