Skip to content

Commit

Permalink
Update mqtt.c
Browse files Browse the repository at this point in the history
fix mqtt not working with empty user/pass - ported from openshwprojects/OpenBK7231T@2c3af1f
  • Loading branch information
openshwprojects committed Sep 22, 2022
1 parent 633a7ef commit e3cae31
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions components/network/lwip/src/apps/mqtt/mqtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,7 @@ mqtt_client_connect(mqtt_client_t *client, const ip_addr_t *ip_addr, u16_t port,
LWIP_ERROR("mqtt_client_connect: remaining_length overflow", len <= 0xFFFF, return ERR_VAL);
remaining_length = (u16_t)len;
}
if (client_info->client_user != NULL) {
if (client_info->client_user != NULL && client_info->client_user[0] != NULL) {
flags |= MQTT_CONNECT_FLAG_USERNAME;
len = strlen(client_info->client_user);
LWIP_ERROR("mqtt_client_connect: client_info->client_user length overflow", len <= 0xFFFF, return ERR_VAL);
Expand All @@ -1337,7 +1337,7 @@ mqtt_client_connect(mqtt_client_t *client, const ip_addr_t *ip_addr, u16_t port,
LWIP_ERROR("mqtt_client_connect: remaining_length overflow", len <= 0xFFFF, return ERR_VAL);
remaining_length = (u16_t)len;
}
if (client_info->client_pass != NULL) {
if (client_info->client_pass != NULL && client_info->client_pass[0] != NULL) {
flags |= MQTT_CONNECT_FLAG_PASSWORD;
len = strlen(client_info->client_pass);
LWIP_ERROR("mqtt_client_connect: client_info->client_pass length overflow", len <= 0xFFFF, return ERR_VAL);
Expand Down

0 comments on commit e3cae31

Please sign in to comment.