Skip to content
This repository was archived by the owner on Nov 6, 2022. It is now read-only.
This repository was archived by the owner on Nov 6, 2022. It is now read-only.

nread var incorrect (off by 1) when header spans multiple packets #426

Closed
@HAT-DK

Description

@HAT-DK

Found in version 2.8.1.
If a HTTP header spans 2 IP packets the nread state var is off by one.
The bug is caused since the nread var is incremented before a pointer check is done (which decrements the pointer value by 1):
http_parser.c:1637

        COUNT_HEADER_SIZE(p - start);

        if (p == data + len)
          --p;

should have been:

        if (p == data + len)
          --p;

        COUNT_HEADER_SIZE(p - start);

The same issue seems to reside in http_parser:1342

The issue is easily reproduced by injecting part of an HTTP request and verifying the nread var after http_parser_execute: "GET / HTTP/1.1\r\nHost: myhost".

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