From 4ec3d2916863fbfe1a06bda270dddf52ea569800 Mon Sep 17 00:00:00 2001 From: Dirk Ziegelmeier Date: Tue, 19 Jul 2016 08:54:44 +0200 Subject: [PATCH] Fix bug #48504: tcp_debug_print_pcbs reads nonexisting tcp_pcb fields --- src/core/tcp.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/core/tcp.c b/src/core/tcp.c index 0edf879c..0bc171c5 100644 --- a/src/core/tcp.c +++ b/src/core/tcp.c @@ -2023,6 +2023,8 @@ void tcp_debug_print_pcbs(void) { struct tcp_pcb *pcb; + struct tcp_pcb_listen *pcbl; + LWIP_DEBUGF(TCP_DEBUG, ("Active PCB states:\n")); for (pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) { LWIP_DEBUGF(TCP_DEBUG, ("Local port %"U16_F", foreign port %"U16_F" snd_nxt %"U32_F" rcv_nxt %"U32_F" ", @@ -2030,13 +2032,13 @@ tcp_debug_print_pcbs(void) pcb->snd_nxt, pcb->rcv_nxt)); tcp_debug_print_state(pcb->state); } + LWIP_DEBUGF(TCP_DEBUG, ("Listen PCB states:\n")); - for (pcb = (struct tcp_pcb *)tcp_listen_pcbs.pcbs; pcb != NULL; pcb = pcb->next) { - LWIP_DEBUGF(TCP_DEBUG, ("Local port %"U16_F", foreign port %"U16_F" snd_nxt %"U32_F" rcv_nxt %"U32_F" ", - pcb->local_port, pcb->remote_port, - pcb->snd_nxt, pcb->rcv_nxt)); - tcp_debug_print_state(pcb->state); + for (pcbl = tcp_listen_pcbs.listen_pcbs; pcbl != NULL; pcbl = pcbl->next) { + LWIP_DEBUGF(TCP_DEBUG, ("Local port %"U16_F" ", pcbl->local_port)); + tcp_debug_print_state(pcbl->state); } + LWIP_DEBUGF(TCP_DEBUG, ("TIME-WAIT PCB states:\n")); for (pcb = tcp_tw_pcbs; pcb != NULL; pcb = pcb->next) { LWIP_DEBUGF(TCP_DEBUG, ("Local port %"U16_F", foreign port %"U16_F" snd_nxt %"U32_F" rcv_nxt %"U32_F" ",