Skip to content

Commit

Permalink
UNDERTOW-1302 Fix response splitting flaw if headers contain non-asci…
Browse files Browse the repository at this point in the history
…i characters
  • Loading branch information
stuartwdouglas committed Apr 26, 2018
1 parent ea3f9de commit 85d4478
Showing 1 changed file with 3 additions and 2 deletions.
Expand Up @@ -294,8 +294,9 @@ private static void writeString(ByteBuffer buffer, String string) {
int length = string.length(); int length = string.length();
for (int charIndex = 0; charIndex < length; charIndex++) { for (int charIndex = 0; charIndex < length; charIndex++) {
char c = string.charAt(charIndex); char c = string.charAt(charIndex);
if(c != '\r' && c != '\n') { byte b = (byte) c;
buffer.put((byte) c); if(b != '\r' && b != '\n') {
buffer.put(b);
} else { } else {
buffer.put((byte) ' '); buffer.put((byte) ' ');
} }
Expand Down

0 comments on commit 85d4478

Please sign in to comment.