This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 5f2e77e TS-3204: Crash when body_factory file is empty
5f2e77e is described below
commit 5f2e77eaf91de68c1fbf761fd1abf4808d048068
Author: Jari Alhonen <[email protected]>
AuthorDate: Tue Oct 4 09:18:05 2016 +0800
TS-3204: Crash when body_factory file is empty
Set internal buffer to null for empty files to not follow the
crash-prone execution path.
---
proxy/http/HttpTransact.cc | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 6382edb..a16f9e8 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -8291,6 +8291,10 @@ HttpTransact::build_error_response(State *s, HTTPStatus
status_code, const char
// After the body factory is called, a new "body" is allocated, and we must
replace it. It is
// unfortunate that there's no way to avoid this fabrication even when there
is no substitutions...
s->free_internal_msg_buffer();
+ if (len == 0) {
+ // If the file is empty, we may have a malloc(1) buffer. Release it.
+ new_msg = (char *)ats_free_null(new_msg);
+ }
s->internal_msg_buffer = new_msg;
s->internal_msg_buffer_size = len;
s->internal_msg_buffer_fast_allocator_size = -1;
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].