diff --git a/src/apps/mqtt/mqtt.c b/src/apps/mqtt/mqtt.c index 3dc6fb01..6c10bc05 100644 --- a/src/apps/mqtt/mqtt.c +++ b/src/apps/mqtt/mqtt.c @@ -1289,7 +1289,7 @@ mqtt_client_connect(mqtt_client_t *client, const ip_addr_t *ip_addr, u16_t port, /* Length is the sum of 2+"MQTT", protocol level, flags and keep alive */ u16_t remaining_length = 2 + 4 + 1 + 1 + 2; u8_t flags = 0, will_topic_len = 0, will_msg_len = 0; - u8_t client_user_len = 0, client_pass_len = 0; + u16_t client_user_len = 0, client_pass_len = 0; LWIP_ASSERT_CORE_LOCKED(); LWIP_ASSERT("mqtt_client_connect: client != NULL", client != NULL); @@ -1330,9 +1330,9 @@ mqtt_client_connect(mqtt_client_t *client, const ip_addr_t *ip_addr, u16_t port, if (client_info->client_user != NULL) { flags |= MQTT_CONNECT_FLAG_USERNAME; len = strlen(client_info->client_user); - LWIP_ERROR("mqtt_client_connect: client_info->client_user length overflow", len <= 0xFF, return ERR_VAL); + LWIP_ERROR("mqtt_client_connect: client_info->client_user length overflow", len <= 0xFFFF, return ERR_VAL); LWIP_ERROR("mqtt_client_connect: client_info->client_user length must be > 0", len > 0, return ERR_VAL); - client_user_len = (u8_t)len; + client_user_len = (u16_t)len; len = remaining_length + 2 + client_user_len; LWIP_ERROR("mqtt_client_connect: remaining_length overflow", len <= 0xFFFF, return ERR_VAL); remaining_length = (u16_t)len; @@ -1340,9 +1340,9 @@ mqtt_client_connect(mqtt_client_t *client, const ip_addr_t *ip_addr, u16_t port, if (client_info->client_pass != NULL) { flags |= MQTT_CONNECT_FLAG_PASSWORD; len = strlen(client_info->client_pass); - LWIP_ERROR("mqtt_client_connect: client_info->client_pass length overflow", len <= 0xFF, return ERR_VAL); + LWIP_ERROR("mqtt_client_connect: client_info->client_pass length overflow", len <= 0xFFFF, return ERR_VAL); LWIP_ERROR("mqtt_client_connect: client_info->client_pass length must be > 0", len > 0, return ERR_VAL); - client_pass_len = (u8_t)len; + client_pass_len = (u16_t)len; len = remaining_length + 2 + client_pass_len; LWIP_ERROR("mqtt_client_connect: remaining_length overflow", len <= 0xFFFF, return ERR_VAL); remaining_length = (u16_t)len;