Skip to content

WhdSTAInterface::set_timeout(_timeout) crashes: 0239-WHD-add-join-timeout-parameter-to-WiFiSTAInterface-a.patch has a bug. #1008

Closed
@dac1e

Description

@dac1e

0239-WHD-add-join-timeout-parameter-to-WiFiSTAInterface-a.patch has a bug.

This patch introduced the override of a new function 'nsapi_error_t set_timeout(uint32_t timeout)'.

The function in the patch file has no return value and looks as follows:

nsapi_error_t set_timeout(uint32_t timeout)
{
_timeout = timeout;
}

It should look as follows:

nsapi_error_t set_timeout(uint32_t timeout)
{
_timeout = timeout;
return NSAPI_ERROR_OK;
}

When I run the WifiAdvanceChatServer example on Arduino Giga, the function call

wifi_if->set_timeout(_timeout);

in line 78 of library file Wifi.cpp crashed.
The function set_timeout(uint32_t timeout) didn't return and rather fell through into the
implementation of

nsapi_error_t WhdSTAInterface::connect(
const char *ssid, const char *pass,
nsapi_security_t security,
uint8_t channel)

which crashed, because the function accessed random parameter values.

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