Skip to content

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

@jfortmann

Description

@jfortmann

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions