Author: kotkov
Date: Mon Dec 7 09:51:16 2015
New Revision: 1718269
URL: http://svn.apache.org/viewvc?rev=1718269&view=rev
Log:
* subversion/mod_dav_svn/util.c
(request_body_to_string): Defer the actual memory allocation to the
moment when are ready to read the request body from the buckets.
Modified:
subversion/trunk/subversion/mod_dav_svn/util.c
Modified: subversion/trunk/subversion/mod_dav_svn/util.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/util.c?rev=1718269&r1=1718268&r2=1718269&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/util.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/util.c Mon Dec 7 09:51:16 2015
@@ -779,7 +779,12 @@ request_body_to_string(svn_string_t **re
if (content_length)
{
- buf = svn_stringbuf_create_ensure(content_length, pool);
+ /* Do not allocate more than 1 MB until we receive request body. */
+ apr_size_t alloc_len = 1 * 1024 *1024;
+ if (content_length < alloc_len)
+ alloc_len = (apr_size_t) content_length;
+
+ buf = svn_stringbuf_create_ensure(alloc_len, pool);
}
else
{