Skip to content

fix(stack): grow CONNECT encode buffer to 1024 bytes#82

Merged
MathiasKoch merged 1 commit into
masterfrom
fix/connect-buffer-size
Jul 13, 2026
Merged

fix(stack): grow CONNECT encode buffer to 1024 bytes#82
MathiasKoch merged 1 commit into
masterfrom
fix/connect-buffer-size

Conversation

@MathiasKoch

Copy link
Copy Markdown
Member

Summary

The MQTT CONNECT packet is encoded into a 512-byte stack buffer (src/stack.rs:566).

AWS IoT custom authentication passes the authorizer token as the MQTT password, which is a JWT several hundred bytes long. Combined with client_id, username, and any last_will, the encoded CONNECT exceeds 512 bytes, so encode_packet fails and the connection is aborted before CONNACK.

Grow the buffer to 1024 bytes to accommodate a full custom-auth CONNECT. The buffer is scoped to the CONNECT send and freed immediately after, so the extra stack is transient.

The CONNECT packet is encoded into a 512-byte stack buffer. AWS IoT custom
authentication passes the authorizer token as the MQTT password, which is a
JWT several hundred bytes long; combined with client_id and username the
encoded CONNECT exceeds 512 bytes and encode_packet fails, aborting the
connection. Grow the buffer to 1024 to accommodate a full custom-auth
CONNECT.
@MathiasKoch
MathiasKoch merged commit 6bc92de into master Jul 13, 2026
6 checks passed
@MathiasKoch
MathiasKoch deleted the fix/connect-buffer-size branch July 13, 2026 10:17
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