From c4df7557eeb827b35965780a7ebd682a720d4a5e Mon Sep 17 00:00:00 2001 From: Wiebe Cazemier Date: Sat, 9 Oct 2021 14:47:43 +0200 Subject: [PATCH] Require topics to be present in subscribe packet --- mqttpacket.cpp | 6 ++++++ 1 file changed, 6 insertions(+), 0 deletions(-) diff --git a/mqttpacket.cpp b/mqttpacket.cpp index 055b1cd..70b2192 100644 --- a/mqttpacket.cpp +++ b/mqttpacket.cpp @@ -468,6 +468,12 @@ void MqttPacket::handleSubscribe() } } + // MQTT-3.8.3-3 + if (subs_reponse_codes.empty()) + { + throw ProtocolError("No topics specified to subscribe to."); + } + SubAck subAck(packet_id, subs_reponse_codes); MqttPacket response(subAck); sender->writeMqttPacket(response); -- libgit2 0.21.4