Commits

Roger Light committed 954b183

Don't accept QoS==3.

Comments (0)

Files changed (3)

 
 Broker:
 - Prevent possible crash on client reconnect. Closes bug #1294108.
-- Don't accept zero length unsubscription strings.
+- Don't accept zero length unsubscription strings (MQTT v3.1.1 fix)
+- Don't accept QoS 3 (MQTT v3.1.1 fix)
 
 Clients:
 - Fix keepalive value on mosquitto_pub.

src/read_handle.c

 
 	dup = (header & 0x08)>>3;
 	qos = (header & 0x06)>>1;
+	if(qos == 3){
+		_mosquitto_log_printf(NULL, MOSQ_LOG_INFO,
+				"Invalid QoS in PUBLISH from %s, disconnecting.", context->id);
+		return 1;
+	}
 	retain = (header & 0x01);
 
 	if(_mosquitto_read_string(&context->in_packet, &topic)) return 1;

src/read_handle_server.c

 	will = connect_flags & 0x04;
 	will_qos = (connect_flags & 0x18) >> 3;
 	if(will_qos == 3){
+		_mosquitto_log_printf(NULL, MOSQ_LOG_INFO, "Invalid Will QoS in CONNECT from %s.",
+				context->address);
 		mqtt3_context_disconnect(db, context);
 		return MOSQ_ERR_PROTOCOL;
 	}