mirror of
https://github.com/eclipse/paho.mqtt-sn.embedded-c.git
synced 2025-12-13 07:26:52 +01:00
Validate MsgId of PUBLISH
MsgId of QoS0 or QoS-1 should be 0. Signed-off-by: tomoaki <tomoaki@tomy-tech.com>
This commit is contained in:
@@ -94,6 +94,12 @@ MQTTGWPacket* MQTTSNPublishHandler::handlePublish(Client* client, MQTTSNPacket*
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if ( ( qos == 0 || qos == 3 ) && msgId > 0 )
|
||||
{
|
||||
WRITELOG("%s Invalid MsgId.%s %s\n", ERRMSG_HEADER, client->getClientId(), ERRMSG_FOOTER);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if( !topic && msgId && qos > 0 && qos < 3 )
|
||||
{
|
||||
/* Reply PubAck with INVALID_TOPIC_ID to the client */
|
||||
|
||||
Reference in New Issue
Block a user