eclipse-paho / paho.mqtt.java

Eclipse Paho Java MQTT client library. Paho is an Eclipse IoT project.
https://eclipse.org/paho
Other
2.14k stars 887 forks source link

[BUG] RECEIVE_MAXIMUM, TOPIC_ALIAS should be unsignedShort #1042

Open DongyuanPan opened 4 months ago

DongyuanPan commented 4 months ago

Please fill out the form below before submitting, thank you!

image According to the MQTT 5.0 protocol, RECEIVE_MAXIMUM should be in the range [0, 65535], but when the property is resolved, readShort() is used, which causes the range to be [-32768, 32767]. For example, if the server sends 65535(0xFFFF), the parsing will overflow and RECEIVE_MAXIMUM will be -1.

TOPIC_ALIAS_MAXIMUM and TOPIC_ALIAS the same as RECEIVE_MAXIMUM.