Author: kkolinko
Date: Thu Feb  5 02:57:13 2015
New Revision: 1657459

URL: http://svn.apache.org/r1657459
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=57509
Improve length check in OutputBuffer.write() to account for 4 extra bytes that 
are needed to terminates the headers.

Modified:
    tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java?rev=1657459&r1=1657458&r2=1657459&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java Thu Feb  
5 02:57:13 2015
@@ -539,7 +539,9 @@ public class Http11OutputBuffer implemen
      * requested number of bytes.
      */
     private void checkLengthBeforeWrite(int length) {
-        if (pos + length > headerBuffer.length) {
+        // "+ 4": BZ 57509. Reserve space for CR/LF/COLON/SP characters that
+        // are put directly into the buffer following this write operation.
+        if (pos + length + 4 > headerBuffer.length) {
             throw new HeadersTooLargeException(
                     sm.getString("iob.responseheadertoolarge.error"));
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to