summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorGreg Ames <gregames@apache.org>2003-03-24 17:39:25 +0100
committerGreg Ames <gregames@apache.org>2003-03-24 17:39:25 +0100
commit335a2bffeeaa8522f03edee20724e30d0ff4d268 (patch)
treecd34572e505a33c0086d3ed0eeea3893c956a538 /server
parentOops - undo wrong commit (diff)
downloadapache2-335a2bffeeaa8522f03edee20724e30d0ff4d268.tar.xz
apache2-335a2bffeeaa8522f03edee20724e30d0ff4d268.zip
ap_get_mime_headers_core: allocate space for the trailing null when there
are folded headers. PR 18170 [Peter Mayne <PeterMayne@SPAM_SUX.ap.spherion.com>] git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@99057 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server')
-rw-r--r--server/protocol.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/server/protocol.c b/server/protocol.c
index 84c17338e0..e23ad88ac1 100644
--- a/server/protocol.c
+++ b/server/protocol.c
@@ -798,11 +798,12 @@ AP_DECLARE(void) ap_get_mime_headers_core(request_rec *r, apr_bucket_brigade *bb
* doing O(n) allocs and using O(n^2) space for
* continuations that span many many lines.
*/
- if (last_len + len > alloc_len) {
+ apr_size_t fold_len = last_len + len + 1; /* trailing null */
+ if (fold_len > alloc_len) {
char *fold_buf;
alloc_len += alloc_len;
- if (last_len + len > alloc_len) {
- alloc_len = last_len + len;
+ if (fold_len > alloc_len) {
+ alloc_len = fold_len;
}
fold_buf = (char *)apr_palloc(r->pool, alloc_len);
memcpy(fold_buf, last_field, last_len);