c9bb450be8
- Added a patch for CVE-2013-4484 from upstream, closing #1025128
113 lines
3.1 KiB
Diff
113 lines
3.1 KiB
Diff
diff -Naur ../varnish-3.0.4.orig/bin/varnishd/cache_center.c ./bin/varnishd/cache_center.c
|
|
--- ../varnish-3.0.4.orig/bin/varnishd/cache_center.c 2013-06-14 10:39:31.000000000 +0200
|
|
+++ ./bin/varnishd/cache_center.c 2013-11-21 00:48:00.486460486 +0100
|
|
@@ -1471,9 +1471,12 @@
|
|
static int
|
|
cnt_start(struct sess *sp)
|
|
{
|
|
- uint16_t done;
|
|
+ uint16_t err_code;
|
|
char *p;
|
|
- const char *r = "HTTP/1.1 100 Continue\r\n\r\n";
|
|
+ const char *r_100 = "HTTP/1.1 100 Continue\r\n\r\n";
|
|
+ const char *r_400 = "HTTP/1.1 400 Bad Request\r\n\r\n";
|
|
+ const char *r_413 = "HTTP/1.1 413 Request Entity Too Large\r\n\r\n";
|
|
+ const char *r_417 = "HTTP/1.1 417 Expectation Failed\r\n\r\n";
|
|
|
|
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
|
|
AZ(sp->restarts);
|
|
@@ -1496,10 +1499,14 @@
|
|
sp->wrk->vcl = NULL;
|
|
|
|
http_Setup(sp->http, sp->ws);
|
|
- done = http_DissectRequest(sp);
|
|
+ err_code = http_DissectRequest(sp);
|
|
|
|
/* If we could not even parse the request, just close */
|
|
- if (done == 400) {
|
|
+ if (err_code == 400)
|
|
+ (void)write(sp->fd, r_400, strlen(r_400));
|
|
+ else if (err_code == 413)
|
|
+ (void)write(sp->fd, r_413, strlen(r_413));
|
|
+ if (err_code != 0) {
|
|
sp->step = STP_DONE;
|
|
vca_close_session(sp, "junk");
|
|
return (0);
|
|
@@ -1511,12 +1518,6 @@
|
|
/* Catch original request, before modification */
|
|
HTTP_Copy(sp->http0, sp->http);
|
|
|
|
- if (done != 0) {
|
|
- sp->err_code = done;
|
|
- sp->step = STP_ERROR;
|
|
- return (0);
|
|
- }
|
|
-
|
|
sp->doclose = http_DoConnection(sp->http);
|
|
|
|
/* XXX: Handle TRACE & OPTIONS of Max-Forwards = 0 */
|
|
@@ -1526,13 +1527,14 @@
|
|
*/
|
|
if (http_GetHdr(sp->http, H_Expect, &p)) {
|
|
if (strcasecmp(p, "100-continue")) {
|
|
- sp->err_code = 417;
|
|
- sp->step = STP_ERROR;
|
|
+ (void)write(sp->fd, r_417, strlen(r_417));
|
|
+ sp->step = STP_DONE;
|
|
+ vca_close_session(sp, "junk");
|
|
return (0);
|
|
}
|
|
|
|
/* XXX: Don't bother with write failures for now */
|
|
- (void)write(sp->fd, r, strlen(r));
|
|
+ (void)write(sp->fd, r_100, strlen(r_100));
|
|
/* XXX: When we do ESI includes, this is not removed
|
|
* XXX: because we use http0 as our basis. Believed
|
|
* XXX: safe, but potentially confusing.
|
|
diff -Naur ../varnish-3.0.4.orig/bin/varnishd/cache_http.c ./bin/varnishd/cache_http.c
|
|
--- ../varnish-3.0.4.orig/bin/varnishd/cache_http.c 2013-06-14 10:39:31.000000000 +0200
|
|
+++ ./bin/varnishd/cache_http.c 2013-11-21 00:48:00.486460486 +0100
|
|
@@ -601,7 +601,7 @@
|
|
hp->hd[h2].e = p;
|
|
|
|
if (!Tlen(hp->hd[h2]))
|
|
- return (413);
|
|
+ return (400);
|
|
|
|
/* Skip SP */
|
|
for (; vct_issp(*p); p++) {
|
|
diff -Naur ../varnish-3.0.4.orig/bin/varnishtest/tests/r01367.vtc ./bin/varnishtest/tests/r01367.vtc
|
|
--- ../varnish-3.0.4.orig/bin/varnishtest/tests/r01367.vtc 1970-01-01 01:00:00.000000000 +0100
|
|
+++ ./bin/varnishtest/tests/r01367.vtc 2013-11-21 00:48:00.486460486 +0100
|
|
@@ -0,0 +1,30 @@
|
|
+varnishtest "blank GET"
|
|
+
|
|
+server s1 {
|
|
+ rxreq
|
|
+ txresp
|
|
+} -start
|
|
+
|
|
+varnish v1 -vcl+backend {
|
|
+ sub vcl_error {
|
|
+ return (restart);
|
|
+ }
|
|
+} -start
|
|
+
|
|
+client c1 {
|
|
+ send "GET \nHost: example.com\n\n"
|
|
+ rxresp
|
|
+ expect resp.status == 400
|
|
+} -run
|
|
+
|
|
+client c1 {
|
|
+ txreq -hdr "Expect: Santa-Claus"
|
|
+ rxresp
|
|
+ expect resp.status == 417
|
|
+} -run
|
|
+
|
|
+client c1 {
|
|
+ txreq
|
|
+ rxresp
|
|
+ expect resp.status == 200
|
|
+} -run
|