You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mosquitto/debian/patches/bug-1367.patch

33 lines
1.2 KiB
Diff

Description: Fix for v5 DISCONNECT packets with remaining length=2
Author: Roger Light <roger@atchoo.org>
Forwarded: not-needed
--- a/src/handle_disconnect.c
+++ b/src/handle_disconnect.c
@@ -34,12 +34,12 @@ int handle__disconnect(struct mosquitto_db *db, struct mosquitto *context)
return MOSQ_ERR_INVAL;
}
- if(context->protocol == mosq_p_mqtt5 && context->in_packet.remaining_length > 1){
+ if(context->protocol == mosq_p_mqtt5 && context->in_packet.remaining_length > 0){
/* FIXME - must handle reason code */
rc = packet__read_byte(&context->in_packet, &reason_code);
if(rc) return rc;
- if(context->in_packet.remaining_length > 2){
+ if(context->in_packet.remaining_length > 1){
rc = property__read_all(CMD_DISCONNECT, &context->in_packet, &properties);
if(rc) return rc;
}
@@ -54,7 +54,7 @@ int handle__disconnect(struct mosquitto_db *db, struct mosquitto *context)
}
mosquitto_property_free_all(&properties); /* FIXME - TEMPORARY UNTIL PROPERTIES PROCESSED */
- if(context->in_packet.remaining_length != 0){
+ if(context->in_packet.pos != context->in_packet.remaining_length){
return MOSQ_ERR_PROTOCOL;
}
log__printf(NULL, MOSQ_LOG_DEBUG, "Received DISCONNECT from %s", context->id);
--
2.17.1