From: Jim Jagielski Date: Wed, 20 Jan 2016 17:54:38 +0000 (+0000) Subject: expand and err-check... X-Git-Tag: 2.5.0-alpha~2347 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e0318bf236065eae3e4c0f8b6f114c5ef494b6b5;p=apache expand and err-check... git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1725766 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/util_expr_eval.c b/server/util_expr_eval.c index 4db48d3966..2a995e551b 100644 --- a/server/util_expr_eval.c +++ b/server/util_expr_eval.c @@ -1065,10 +1065,11 @@ static const char *kb_func(ap_expr_eval_ctx_t *ctx, const void *data, if (rv != APR_SUCCESS || len == 0) return ""; - buf = apr_palloc(ctx->r->pool, len); - apr_brigade_flatten(ctx->r->kept_body, buf, &len); - if (len) - buf[len-1] = '\0'; /* ensure */ + buf = apr_palloc(ctx->r->pool, len+1); + rv = apr_brigade_flatten(ctx->r->kept_body, buf, &len); + if (rv != APR_SUCCESS) + return ""; + buf[len] = '\0'; /* ensure */ return (const char*)buf; }