Skip to content

WiFiUDP.parseInt - Infinite Loop/WDT Reset #1796

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

Closed
AllanMar opened this issue Mar 19, 2016 · 0 comments
Closed

WiFiUDP.parseInt - Infinite Loop/WDT Reset #1796

AllanMar opened this issue Mar 19, 2016 · 0 comments

Comments

@AllanMar
Copy link

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();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants