#! /bin/sh /usr/share/dpatch/dpatch-run ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: mod_deflate DoS ## DP: http://mail-archives.apache.org/mod_mbox/httpd-dev/200907.mbox/<20090703100048.GA4492@redhat.com> ## DP: Also add some workaround to mod_deflate for bucket lifetime issues with packages using the old ## DP: write filter (like mod_php) @DPATCH@ diff -urNad apache2-2.2.3~/modules/filters/mod_deflate.c apache2-2.2.3/modules/filters/mod_deflate.c --- apache2-2.2.3~/modules/filters/mod_deflate.c 2006-07-12 05:38:44.000000000 +0200 +++ apache2-2.2.3/modules/filters/mod_deflate.c 2009-07-26 20:03:36.775287199 +0200 @@ -512,6 +512,7 @@ APR_BRIGADE_INSERT_TAIL(ctx->bb, bkt); rv = ap_pass_brigade(f->next, ctx->bb); if (rv != APR_SUCCESS) { + apr_brigade_cleanup(bb); return rv; } continue; @@ -543,6 +544,7 @@ /* Send what we have right now to the next filter. */ rv = ap_pass_brigade(f->next, ctx->bb); if (rv != APR_SUCCESS) { + apr_brigade_cleanup(bb); return rv; } } diff -urNad apache2-2.2.3~/server/core_filters.c apache2-2.2.3/server/core_filters.c --- apache2-2.2.3~/server/core_filters.c 2006-07-12 05:38:44.000000000 +0200 +++ apache2-2.2.3/server/core_filters.c 2009-07-26 20:03:11.859244098 +0200 @@ -542,6 +542,12 @@ apr_read_type_e eblock = APR_NONBLOCK_READ; apr_pool_t *input_pool = b->p; + /* Fail quickly if the connection has already been aborted. */ + if (c->aborted) { + apr_brigade_cleanup(b); + return APR_ECONNABORTED; + } + if (ctx == NULL) { ctx = apr_pcalloc(c->pool, sizeof(*ctx)); net->out_ctx = ctx; @@ -909,12 +915,9 @@ /* No need to check for SUCCESS, we did that above. */ if (!APR_STATUS_IS_EAGAIN(rv)) { c->aborted = 1; + return APR_ECONNABORTED; } - /* The client has aborted, but the request was successful. We - * will report success, and leave it to the access and error - * logs to note that the connection was aborted. - */ return APR_SUCCESS; }