From bec8cf9f38d3d86da5aa78f82ef30bbd3cb20f86 Mon Sep 17 00:00:00 2001 From: goldsimon Date: Sat, 21 Jan 2012 16:57:53 +0100 Subject: [PATCH] Fixed my last chagne to pbuf_copy --- src/core/pbuf.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/pbuf.c b/src/core/pbuf.c index 1258bb36..1e5e53b1 100644 --- a/src/core/pbuf.c +++ b/src/core/pbuf.c @@ -875,18 +875,18 @@ pbuf_copy(struct pbuf *p_to, struct pbuf *p_from) offset_to += len; offset_from += len; LWIP_ASSERT("offset_to <= p_to->len", offset_to <= p_to->len); - if (offset_to == p_to->len) { - /* on to next p_to (if any) */ - offset_to = 0; - p_to = p_to->next; - LWIP_ERROR("p_to != NULL", p_to != NULL, return ERR_ARG;); - } LWIP_ASSERT("offset_from <= p_from->len", offset_from <= p_from->len); if (offset_from >= p_from->len) { /* on to next p_from (if any) */ offset_from = 0; p_from = p_from->next; } + if (offset_to == p_to->len) { + /* on to next p_to (if any) */ + offset_to = 0; + p_to = p_to->next; + LWIP_ERROR("p_to != NULL", (p_to != NULL) || (p_from == NULL) , return ERR_ARG;); + } if((p_from != NULL) && (p_from->len == p_from->tot_len)) { /* don't copy more than one packet! */