[4.0] 4e3aa51 Escape question marks in C-strings to avoid accidentally generating tri-graphs.
Lasse Karstensen
lkarsten at varnish-software.com
Tue Jan 27 14:39:39 CET 2015
commit 4e3aa514ecf174bb549e5f0daa0d46957ba196c0
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Wed Aug 27 10:01:49 2014 +0000
Escape question marks in C-strings to avoid accidentally generating
tri-graphs.
Fixes #1566
diff --git a/bin/varnishtest/tests/r01566.vtc b/bin/varnishtest/tests/r01566.vtc
new file mode 100644
index 0000000..fdf79a4
--- /dev/null
+++ b/bin/varnishtest/tests/r01566.vtc
@@ -0,0 +1,9 @@
+varnishtest "escape issue in regexp"
+
+varnish v1 -vcl {
+ backend b1 { .host = "127.0.0.1"; }
+
+ sub vcl_recv {
+ set req.url = regsuball(req.url, "\??(p|pi)=.*?(&|$)", "");
+ }
+}
diff --git a/lib/libvcc/vcc_compile.c b/lib/libvcc/vcc_compile.c
index 7bc4bc2..5a47390 100644
--- a/lib/libvcc/vcc_compile.c
+++ b/lib/libvcc/vcc_compile.c
@@ -211,6 +211,7 @@ EncString(struct vsb *sb, const char *b, const char *e, int mode)
VSB_cat(sb, "\"");
for (; b < e; b++) {
switch (*b) {
+ case '?': // Trigraphs
case '\\':
case '"':
VSB_printf(sb, "\\%c", *b);
More information about the varnish-commit
mailing list