Skip to content

Treat CRLF as one line terminator in safeReadLine - #931

Open
VolodymyrLinuxovich wants to merge 1 commit into
ESAPI:developfrom
VolodymyrLinuxovich:issue-423
Open

VolodymyrLinuxovich wants to merge 1 commit into
ESAPI:developfrom
VolodymyrLinuxovich:issue-423

Conversation

@VolodymyrLinuxovich

Copy link
Copy Markdown

Fixes #423.

DefaultValidator.safeReadLine stopped at a CR and left the following LF in the stream. On input with Windows line endings every other call returned an empty line.

When the method reads a CR it now peeks at the next byte and consumes it if it is an LF. Peeking needs mark and reset, so this only happens when the stream supports marks. The Javadoc says so and suggests wrapping the stream in a BufferedInputStream otherwise.

The new test reads LF, CR and CRLF endings plus an empty CRLF line. It also checks the output against BufferedReader.readLine. It fails on develop and passes with this change. ValidatorTest and the access controller tests pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DefaultValidator.safeReadLine() Does not handle CRLF

1 participant