Patch #1625. Check ipaddr != NULL, also in ip_addr_debug_print() macro.

This commit is contained in:
likewise 2003-06-19 10:33:58 +00:00
parent d61b274a09
commit a9cd9d185c
3 changed files with 7 additions and 7 deletions

View File

@ -457,7 +457,9 @@ udp_bind(struct udp_pcb *pcb, struct ip_addr *ipaddr, u16_t port)
{ {
struct udp_pcb *ipcb; struct udp_pcb *ipcb;
u8_t rebind; u8_t rebind;
LWIP_DEBUGF(UDP_DEBUG | DBG_TRACE | 3, ("udp_bind(ipaddr = %lx, port = %u)\n", ipaddr->addr, port)); LWIP_DEBUGF(UDP_DEBUG | DBG_TRACE | 3, ("udp_bind(ipaddr = "));
ip_addr_debug_print(UDP_DEBUG, ipaddr);
LWIP_DEBUGF(UDP_DEBUG | DBG_TRACE | 3, (", port = %u)\n", port));
rebind = 0; rebind = 0;
/* Check for double bind and rebind of the same pcb */ /* Check for double bind and rebind of the same pcb */
for (ipcb = udp_pcbs; ipcb != NULL; ipcb = ipcb->next) { for (ipcb = udp_pcbs; ipcb != NULL; ipcb = ipcb->next) {

View File

@ -119,10 +119,10 @@ extern const struct ip_addr ip_addr_broadcast;
#define ip_addr_debug_print(debug, ipaddr) LWIP_DEBUGF(debug, ("%u.%u.%u.%u", \ #define ip_addr_debug_print(debug, ipaddr) LWIP_DEBUGF(debug, ("%u.%u.%u.%u", \
(unsigned int)(ntohl((ipaddr)->addr) >> 24) & 0xff, \ ipaddr?(unsigned int)(ntohl((ipaddr)->addr) >> 24) & 0xff:0, \
(unsigned int)(ntohl((ipaddr)->addr) >> 16) & 0xff, \ ipaddr?(unsigned int)(ntohl((ipaddr)->addr) >> 16) & 0xff:0, \
(unsigned int)(ntohl((ipaddr)->addr) >> 8) & 0xff, \ ipaddr?(unsigned int)(ntohl((ipaddr)->addr) >> 8) & 0xff:0, \
(unsigned int)ntohl((ipaddr)->addr) & 0xff)) ipaddr?(unsigned int)ntohl((ipaddr)->addr) & 0xff:0U))
/* cast to unsigned int, as it is used as argument to printf functions /* cast to unsigned int, as it is used as argument to printf functions
* which expect integer arguments */ * which expect integer arguments */

View File

@ -38,8 +38,6 @@
#include "lwip/inet.h" #include "lwip/inet.h"
#include "lwip/ip.h" #include "lwip/ip.h"
#include "lwip/err.h"
#define UDP_HLEN 8 #define UDP_HLEN 8
struct udp_hdr { struct udp_hdr {