Commit c4df7557eeb827b35965780a7ebd682a720d4a5e
1 parent
86fb73e0
Require topics to be present in subscribe packet
MQTT-3.8.3-3
Showing
1 changed file
with
6 additions
and
0 deletions
mqttpacket.cpp
| @@ -468,6 +468,12 @@ void MqttPacket::handleSubscribe() | @@ -468,6 +468,12 @@ void MqttPacket::handleSubscribe() | ||
| 468 | } | 468 | } |
| 469 | } | 469 | } |
| 470 | 470 | ||
| 471 | + // MQTT-3.8.3-3 | ||
| 472 | + if (subs_reponse_codes.empty()) | ||
| 473 | + { | ||
| 474 | + throw ProtocolError("No topics specified to subscribe to."); | ||
| 475 | + } | ||
| 476 | + | ||
| 471 | SubAck subAck(packet_id, subs_reponse_codes); | 477 | SubAck subAck(packet_id, subs_reponse_codes); |
| 472 | MqttPacket response(subAck); | 478 | MqttPacket response(subAck); |
| 473 | sender->writeMqttPacket(response); | 479 | sender->writeMqttPacket(response); |