Commit 5e2a759b authored by Tollef Fog Heen's avatar Tollef Fog Heen

Handle the case of sub being NULL

if sub is null (because it's the contents of a non-existing header),
pretend it's "" instead.
parent 6b4dfb86
......@@ -101,6 +101,8 @@ VRT_regsub(const struct sess *sp, int all, const char *str, void *re,
AN(re);
if (str == NULL)
str = "";
if (sub == NULL)
sub = "";
t = re;
memset(ovector, 0, sizeof(ovector));
len = strlen(str);
......
......@@ -21,6 +21,8 @@ varnish v1 -vcl+backend {
regsub(beresp.http.Foobar, "(b)(a)(r)(f)", "\0\4\3\2\\p");
set beresp.http.Snafu6 =
regsub(beresp.http.Foobar, "(b)(a)(r)(f)", "\4\&\3\2p\");
set beresp.http.Snafu7 =
regsub(beresp.http.Foobar, "ar", req.http.nosuchheader);
}
} -start
......@@ -37,4 +39,5 @@ client c1 {
# NB: have to escape the \\ in the next two lines
expect resp.http.snafu5 == "_barffra\\p_"
expect resp.http.snafu6 == "_f&rap\\_"
expect resp.http.snafu7 == "_bf_"
} -run
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment