@@ -441,8 +441,9 @@ int MqttEncode_Props(MqttPacketType packet, MqttProp* props, byte* buf)
441441 }
442442 case MQTT_DATA_TYPE_STRING :
443443 {
444- tmp = MqttEncode_String (buf ,
445- (const char * )cur_prop -> data_str .str );
444+ tmp = MqttEncode_Data (buf ,
445+ (const byte * )cur_prop -> data_str .str ,
446+ cur_prop -> data_str .len );
446447 rc += tmp ;
447448 if (buf != NULL ) {
448449 buf += tmp ;
@@ -475,15 +476,17 @@ int MqttEncode_Props(MqttPacketType packet, MqttProp* props, byte* buf)
475476 {
476477 /* String is prefixed with a Two Byte Integer length field that
477478 gives the number of bytes */
478- tmp = MqttEncode_String (buf ,
479- (const char * )cur_prop -> data_str .str );
479+ tmp = MqttEncode_Data (buf ,
480+ (const byte * )cur_prop -> data_str .str ,
481+ cur_prop -> data_str .len );
480482 rc += tmp ;
481483 if (buf != NULL ) {
482484 buf += tmp ;
483485 }
484486
485- tmp = MqttEncode_String (buf ,
486- (const char * )cur_prop -> data_str2 .str );
487+ tmp = MqttEncode_Data (buf ,
488+ (const byte * )cur_prop -> data_str2 .str ,
489+ cur_prop -> data_str2 .len );
487490 rc += tmp ;
488491 if (buf != NULL ) {
489492 buf += tmp ;
@@ -2673,9 +2676,9 @@ int MqttProps_Init(void)
26732676 int ret = MQTT_CODE_SUCCESS ;
26742677#if !defined(WOLFMQTT_DYN_PROP ) && defined(WOLFMQTT_MULTITHREAD )
26752678 if (clientPropStack_lockInit == 0 ) {
2676- clientPropStack_lockInit ++ ;
26772679 ret = wm_SemInit (& clientPropStack_lock );
26782680 }
2681+ clientPropStack_lockInit ++ ;
26792682#endif
26802683 return ret ;
26812684}
0 commit comments