mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-02-06 00:39:59 +00:00
Fixed bug in netconn_peer (test pcb for NULL before accessing)
This commit is contained in:
parent
e6cc785fff
commit
a5be8fe82c
@ -301,12 +301,15 @@ netconn_peer(struct netconn *conn, struct ip_addr *addr,
|
|||||||
case NETCONN_UDPLITE:
|
case NETCONN_UDPLITE:
|
||||||
case NETCONN_UDPNOCHKSUM:
|
case NETCONN_UDPNOCHKSUM:
|
||||||
case NETCONN_UDP:
|
case NETCONN_UDP:
|
||||||
if ((conn->pcb.udp->flags & UDP_FLAGS_CONNECTED) == 0)
|
if (conn->pcb.udp == NULL ||
|
||||||
return -1;
|
((conn->pcb.udp->flags & UDP_FLAGS_CONNECTED) == 0))
|
||||||
|
return ERR_CONN;
|
||||||
*addr = (conn->pcb.udp->remote_ip);
|
*addr = (conn->pcb.udp->remote_ip);
|
||||||
*port = conn->pcb.udp->remote_port;
|
*port = conn->pcb.udp->remote_port;
|
||||||
break;
|
break;
|
||||||
case NETCONN_TCP:
|
case NETCONN_TCP:
|
||||||
|
if(conn->pcb.tcp == NULL)
|
||||||
|
return ERR_CONN;
|
||||||
*addr = (conn->pcb.tcp->remote_ip);
|
*addr = (conn->pcb.tcp->remote_ip);
|
||||||
*port = conn->pcb.tcp->remote_port;
|
*port = conn->pcb.tcp->remote_port;
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user