Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request with "Content-Length: -1" fatalErrors #442

Closed
jfortmann opened this issue Jan 14, 2020 · 0 comments · Fixed by #457
Closed

Request with "Content-Length: -1" fatalErrors #442

jfortmann opened this issue Jan 14, 2020 · 0 comments · Fixed by #457

Comments

@jfortmann
Copy link

jfortmann commented Jan 14, 2020

The content length field is parsed without validation in readHttpRequest:

        if let contentLength = request.headers["content-length"], let contentLengthValue = Int(contentLength) {
            request.body = try readBody(socket, size: contentLengthValue)
        }

If content-length is set to -1, this results in the creation of an UnsafeMutableBufferPointer with a negative count downstream, a fatalError.

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 a pull request may close this issue.

1 participant