Skip to content

Multiple instances of MQTT Agent are unsafe due to statically allocated memory #130

@stephenglynch

Description

@stephenglynch

The library seems otherwise well designed to allow multiple instances of MQTT Agents e.g. to support simultaneous connections to more than one broker. However, there are two statically allocated arrays (v1.3.1) used to handle publishes with QoS > 0 that make multiple instances unsafe as the arrays will be reinitialised and the memory effectively shared between instances.

The offending statically allocated arrays are in the function MQTTAgent_Init, named pIncomingPublishRecords and pOutgoingPublishRecords.

It would seem reasonable to move these arrays into MQTTAgentContext_t which should make the library safe.

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