mirror of
https://github.com/esphome/esphome.git
synced 2026-09-17 10:08:40 +00:00
Check socket type before accessing pcb.tcp union member
Move the NETCONN_TCP type check before the pcb.tcp null check to avoid reading the wrong union member on non-TCP sockets.
This commit is contained in:
@@ -218,10 +218,12 @@ void esphome_lwip_hook_socket(struct lwip_sock *sock) {
|
||||
}
|
||||
|
||||
bool esphome_lwip_set_nodelay(struct lwip_sock *sock, bool enable) {
|
||||
if (sock == NULL || sock->conn == NULL || sock->conn->pcb.tcp == NULL)
|
||||
if (sock == NULL || sock->conn == NULL)
|
||||
return false;
|
||||
if (NETCONNTYPE_GROUP(sock->conn->type) != NETCONN_TCP)
|
||||
return false;
|
||||
if (sock->conn->pcb.tcp == NULL)
|
||||
return false;
|
||||
if (enable) {
|
||||
tcp_nagle_disable(sock->conn->pcb.tcp);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user