Skip to content

Crash in MQTTPacket_suback due to uninitialized MQTT properties #1692

Description

@kili236

Describe the bug
For MQTT versions below 5, pack->properties is left uninitialized because Suback is allocated using malloc(). On an error path, pack->properties.array is evaluated in a conditional cleanup check. Since the member is uninitialized, this can result in an invalid pointer being passed to free(), causing a crash.

On the affected system, the uninitialized properties.array happened to contain a non-zero value, causing the cleanup code to call free() on an invalid address.

Expected behavior
No crash occurs with MQTT version below 5.

Environment (please complete the following information):
Linux

Additional context
Crash discovered while performing fuzz testing. With the attached patched applied, the crash does not occur anymore.

Patch
0001-Fix-uninitialized-properties-can-cause-crash-in-free.patch

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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