From: Ruediger Pluem Date: Tue, 8 Jan 2008 19:50:01 +0000 (+0000) Subject: * Saveguard ourselves against underflows X-Git-Tag: 2.3.0~1042 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c56e381967c3e2435d803d0aeb30ede00e9b923e;p=apache * Saveguard ourselves against underflows git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@610111 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/http/http_filters.c b/modules/http/http_filters.c index dbc39fdab9..a5ff3ae8f1 100644 --- a/modules/http/http_filters.c +++ b/modules/http/http_filters.c @@ -159,9 +159,17 @@ static apr_status_t get_chunk_line(http_ctx_t *ctx, apr_bucket_brigade *b, int linelimit) { apr_size_t len; + int tmp_len; apr_status_t rv; - len = sizeof(ctx->chunk_ln) - (ctx->pos - ctx->chunk_ln) - 1; + tmp_len = sizeof(ctx->chunk_ln) - (ctx->pos - ctx->chunk_ln) - 1; + /* Saveguard ourselves against underflows */ + if (tmp_len < 0) { + len = 0; + } + else { + len = (apr_size_t) tmp_len; + } /* * Check if there is space left in ctx->chunk_ln. If not, then either * the chunk size is insane or we have chunk-extensions. Ignore both