Skip to content

Cancelling OTA Update in Progress Callback leads to nullptr access #259

@mwesenjak

Description

@mwesenjak

Hi!

When an OTA Update gets cancelled / is stopped within the progress callback, then there are nullptr checks missing within OTA_Handler::Handle_Failure.

Description

  • Start OTA Update by calling OTA_Handler::Start_Firmware_Update()
  • OTA_Update_Callback's progress_callback calls OTA_Handler::Stop_Firmware_Update() at some point
  • OTA_Handler::Stop_Firmware_Update() removes the progress callback / sets the pointer to nullptr
  • OTA_Handler::Process_Firmware_Packet correctly notices that m_fw_callback is a nullptr and calls OTA_Handler::Handle_Failure
  • OTA_Handler::Handle_Failure does not notice that m_fw_callback is a nullptr, this raises an exception and the app crashes

Proposed Fix

Check m_fw_callback == nullptr in OTA_Handler::Handle_Failure before calling m_fw_callback->Call_Callback.

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