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
7f9a989f
Commit
7f9a989f
authored
Jan 02, 2014
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix NULL deref related to a backend we don't know any more.
Fixes #1398
parent
9ba514cc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
4 deletions
+35
-4
cache_vrt.c
bin/varnishd/cache/cache_vrt.c
+2
-0
cache_vrt_var.c
bin/varnishd/cache/cache_vrt_var.c
+13
-4
r01398.vtc
bin/varnishtest/tests/r01398.vtc
+20
-0
No files found.
bin/varnishd/cache/cache_vrt.c
View file @
7f9a989f
...
...
@@ -301,6 +301,8 @@ VRT_IP_string(const struct vrt_ctx *ctx, VCL_IP ip)
unsigned
len
;
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
if
(
ip
==
NULL
)
return
(
NULL
);
len
=
WS_Reserve
(
ctx
->
ws
,
0
);
p
=
ctx
->
ws
->
f
;
VTCP_name
(
ip
,
p
,
len
,
NULL
,
0
);
...
...
bin/varnishd/cache/cache_vrt_var.c
View file @
7f9a989f
...
...
@@ -251,8 +251,14 @@ VRT_r_beresp_backend_name(const struct vrt_ctx *ctx)
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
->
bo
,
BUSYOBJ_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
->
bo
->
vbc
,
VBC_MAGIC
);
return
(
ctx
->
bo
->
vbc
->
backend
->
vcl_name
);
if
(
ctx
->
bo
->
vbc
!=
NULL
)
{
CHECK_OBJ_NOTNULL
(
ctx
->
bo
->
vbc
,
VBC_MAGIC
);
return
(
ctx
->
bo
->
vbc
->
backend
->
vcl_name
);
}
if
(
ctx
->
bo
->
director
!=
NULL
)
{
return
(
ctx
->
bo
->
director
->
vcl_name
);
}
return
(
NULL
);
}
VCL_IP
...
...
@@ -261,8 +267,11 @@ VRT_r_beresp_backend_ip(const struct vrt_ctx *ctx)
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
->
bo
,
BUSYOBJ_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
->
bo
->
vbc
,
VBC_MAGIC
);
return
(
ctx
->
bo
->
vbc
->
addr
);
if
(
ctx
->
bo
->
vbc
!=
NULL
)
{
CHECK_OBJ_NOTNULL
(
ctx
->
bo
->
vbc
,
VBC_MAGIC
);
return
(
ctx
->
bo
->
vbc
->
addr
);
}
else
return
(
NULL
);
}
const
char
*
...
...
bin/varnishtest/tests/r01398.vtc
0 → 100644
View file @
7f9a989f
varnishtest "ticket 1398"
varnish v1 -vcl {
backend foo {
.host = "${bad_ip}"; .port = "9080";
}
sub vcl_backend_response {
set beresp.http.X-BE-Name = beresp.backend.name;
set beresp.http.X-BE-IP = beresp.backend.ip;
}
} -start
client c1 {
txreq
rxresp
expect resp.status == 503
expect resp.http.X-BE-Name == foo
expect resp.http.X-BE-IP == ""
} -run
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