kopia lustrzana https://github.com/martin-ger/esp_mqtt
Update mqtt_server.c
To fix the "MQTT: Out of mem" issue when the given user password is NULL from a clientpull/16/head
rodzic
e3b494b70f
commit
82c0bd1706
|
@ -529,7 +529,9 @@ static void ICACHE_FLASH_ATTR MQTT_ClientCon_recv_cb(void *arg, char *pdata, uns
|
|||
const char *password =
|
||||
mqtt_get_str(&clientcon->mqtt_state.in_buffer[2 + msg_used_len], &password_len);
|
||||
|
||||
if (password != NULL)
|
||||
if (password == NULL) {
|
||||
clientcon->connect_info.password = (char *)NULL;
|
||||
} else {
|
||||
clientcon->connect_info.password = (char *)os_zalloc(password_len+1);
|
||||
if (clientcon->connect_info.password != NULL) {
|
||||
os_memcpy(clientcon->connect_info.password, password, password_len);
|
||||
|
@ -541,6 +543,7 @@ static void ICACHE_FLASH_ATTR MQTT_ClientCon_recv_cb(void *arg, char *pdata, uns
|
|||
clientcon->connState = TCP_DISCONNECTING;
|
||||
break;
|
||||
}
|
||||
}
|
||||
msg_used_len += 2 + password_len;
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue