Fix topic_name validation bug

Prior to this change, Prior to this change, the validation for the mqtt5.0 publish packet
which both contains zero-length topic name and topic alias is wrong.

This change fix this bug.
This commit is contained in:
Gilbert Wong 2018-10-08 20:02:32 +08:00
parent b25dbd866b
commit 52eae65983
1 changed files with 2 additions and 0 deletions

View File

@ -55,6 +55,8 @@ validate(?UNSUBSCRIBE_PACKET(PacketId, TopicFilters)) ->
validate_packet_id(PacketId)
andalso ok == lists:foreach(fun emqx_topic:validate/1, TopicFilters);
validate(?PUBLISH_PACKET(_QoS, <<>>, #{'Topic-Alias':= _I}, _)) ->
true;
validate(?PUBLISH_PACKET(_QoS, <<>>, _, _, _)) ->
error(topic_name_invalid);
validate(?PUBLISH_PACKET(_QoS, Topic, _, Properties, _)) ->