Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/paho/mqtt/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3346,6 +3346,8 @@ def _pack_remaining_length(
self, packet: bytearray, remaining_length: int
) -> bytearray:
remaining_bytes = []
if remaining_length > 268_435_455:
raise ValueError("Packet too large")
while True:
byte = remaining_length % 128
remaining_length = remaining_length // 128
Expand All @@ -3356,7 +3358,6 @@ def _pack_remaining_length(
remaining_bytes.append(byte)
packet.append(byte)
if remaining_length == 0:
# FIXME - this doesn't deal with incorrectly large payloads
return packet

def _pack_str16(self, packet: bytearray, data: bytes | str) -> None:
Expand Down