* FIX [sub_handler] fix issue
@@ -78,6 +78,7 @@ decode_sub_msg(nano_work *work)
topic_option->topic_filter.body =
copy_utf8_str(payload_ptr, &bpos, &len_of_topic);
+
topic_option->topic_filter.len = len_of_topic;
topic_node_t->it->reason_code = GRANTED_QOS_2; // default
@@ -96,7 +97,7 @@ decode_sub_msg(nano_work *work)
topic_option->rap = 1; // Default Setting
memcpy(topic_option, payload_ptr + bpos, 1);
- if (topic_option->retain_handling > 2) {
+ if (topic_option->retain_handling > 2 || topic_option->topic_filter.body == NULL) {
debug_msg("ERROR: error in retain_handling");
topic_node_t->it->reason_code = UNSPECIFIED_ERROR;
return PROTOCOL_ERROR;
