Skip to content

WiFiUDP.parseInt - Infinite Loop/WDT Reset #1796

Closed
@AllanMar

Description

@AllanMar

parseInt can get caught in a loop if called on a buffer with no integers remaining . Which causes peekNextDigit to continue to loop.
peek() should probably check if there is any data left and return -1 otherwise.
WiFiUdp.cpp:

int WiFiUDP::peek()
{
    if (!_ctx)
        return 0;

    return _ctx->peek();
}

Possibly change to:

int WiFiUDP::peek()
{
    if (!_ctx || !available())
        return -1;

    return _ctx->peek();
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions