From c56e381967c3e2435d803d0aeb30ede00e9b923e Mon Sep 17 00:00:00 2001 From: Ruediger Pluem Date: Tue, 8 Jan 2008 19:50:01 +0000 Subject: [PATCH] * Saveguard ourselves against underflows git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@610111 13f79535-47bb-0310-9956-ffa450edef68 --- modules/http/http_filters.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 -- 2.40.0