[master] a1ed842 Allow strings longer than 256 bytes

Tollef Fog Heen tfheen at varnish-cache.org
Fri Apr 8 08:05:48 CEST 2011


commit a1ed842aa2a16a95acc889ab2d158c1afa087e6d
Author: Tollef Fog Heen <tfheen at varnish-software.com>
Date:   Fri Apr 8 08:04:27 2011 +0200

    Allow strings longer than 256 bytes
    
    Use an int rather than a char for counting.
    
    Thanks to Thierry for the diagnosis.
    
    Fixes #896

diff --git a/bin/varnishtest/tests/r00896.vtc b/bin/varnishtest/tests/r00896.vtc
new file mode 100644
index 0000000..6eb4287
--- /dev/null
+++ b/bin/varnishtest/tests/r00896.vtc
@@ -0,0 +1,20 @@
+test "Ticket #896, strings over 256 bytes"
+
+server s1 {
+	rxreq 
+	txresp
+} -start
+
+varnish v1 -vcl+backend {
+	sub vcl_recv {
+	    if (req.http.host ~ "^(abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij)") {
+		error 500 "not ok";
+		}
+	}
+} -start 
+
+client c1 {
+	txreq  
+	rxresp
+	expect resp.status == 200
+} -run
diff --git a/lib/libvcl/vcc_token.c b/lib/libvcl/vcc_token.c
index 6818777..56c9672 100644
--- a/lib/libvcl/vcc_token.c
+++ b/lib/libvcl/vcc_token.c
@@ -350,7 +350,7 @@ static int
 vcc_decstr(struct vcc *tl)
 {
 	char *q;
-	unsigned char l;
+	unsigned int l;
 
 	assert(tl->t->tok == CSTR);
 	l = (tl->t->e - tl->t->b) - 2;



More information about the varnish-commit mailing list