Skip to content

Fix missing error code in persist read error paths#3558

Open
lonelybones wants to merge 1 commit intoeclipse-mosquitto:developfrom
lonelybones:fix/persist-read-missing-rc
Open

Fix missing error code in persist read error paths#3558
lonelybones wants to merge 1 commit intoeclipse-mosquitto:developfrom
lonelybones:fix/persist-read-missing-rc

Conversation

@lonelybones
Copy link
Copy Markdown

In persist__chunk_client_msg_read_v56() and persist__chunk_base_msg_read_v56(), three error paths jump to the error cleanup label without setting rc, causing the functions to return success (0) on malformed input.

A crafted persistence file with a length underflow silently loads a corrupt message with NULL topic and payload pointers, leading to a NULL pointer dereference (SEGV) on the next persistence save.

Confirmed with AddressSanitizer: SEGV in strncmp called from persist__client_messages_save during broker shutdown.

Set rc to the appropriate error code before each goto.

  • Have you signed the Eclipse Contributor Agreement, using the same email address as you used in your commits?
  • Do each of your commits have a "Signed-off-by" line, with the correct email address?
  • If you are contributing a new feature, is your work based off the develop branch?
  • If you are contributing a bugfix, is your work based off the fixes branch?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you successfully run make test with your changes locally?

In persist__chunk_client_msg_read_v56() and
persist__chunk_base_msg_read_v56(), three error paths jump to the
error cleanup label without setting rc, causing the functions to
return success (0) on malformed input.

A crafted persistence file with a length underflow silently loads a
corrupt message with NULL topic and payload pointers, leading to a
NULL pointer dereference (SEGV) on the next persistence save.

Confirmed with AddressSanitizer: SEGV in strncmp called from
persist__client_messages_save during broker shutdown.

Set rc to the appropriate error code before each goto.

Signed-off-by: Andrew Letourneau <0xlonelybones@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant