You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2016/01/20 18:54:38 UTC

svn commit: r1725766 - /httpd/httpd/trunk/server/util_expr_eval.c

Author: jim
Date: Wed Jan 20 17:54:38 2016
New Revision: 1725766

URL: http://svn.apache.org/viewvc?rev=1725766&view=rev
Log:
expand and err-check...

Modified:
    httpd/httpd/trunk/server/util_expr_eval.c

Modified: httpd/httpd/trunk/server/util_expr_eval.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util_expr_eval.c?rev=1725766&r1=1725765&r2=1725766&view=diff
==============================================================================
--- httpd/httpd/trunk/server/util_expr_eval.c (original)
+++ httpd/httpd/trunk/server/util_expr_eval.c Wed Jan 20 17:54:38 2016
@@ -1065,10 +1065,11 @@ static const char *kb_func(ap_expr_eval_
     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;
 }