Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Improve length check in OutputBuffer.write() to account for 4 extra bytes that are needed to terminates the headers.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1657459 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Konstantin Kolinko committed Feb 5, 2015
1 parent e6de91b commit d7491c5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion java/org/apache/coyote/http11/Http11OutputBuffer.java
Expand Up @@ -539,7 +539,9 @@ private void write(String s) {
* 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"));
}
Expand Down

0 comments on commit d7491c5

Please sign in to comment.