From 0b9c9f9ede7f8315fe40bceedc4fbff7a1b12cb0 Mon Sep 17 00:00:00 2001 From: goldsimon Date: Fri, 8 Jun 2007 17:27:36 +0000 Subject: [PATCH] pbuf_copy(): Corrected a wrong comment & try to behave correctly if LWIP_NOASSERT is defined --- src/core/pbuf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/pbuf.c b/src/core/pbuf.c index 9c0fbe41..0abcda36 100644 --- a/src/core/pbuf.c +++ b/src/core/pbuf.c @@ -669,7 +669,9 @@ pbuf_dechain(struct pbuf *p) * * @param p Head of pbuf chain to process * - * @return Pointer to head of pbuf chain + * @return ERR_OK if pbuf was copied + * ERR_ARG if one of the pbufs is NULL or p_to is not big + * enough to hold p_from */ err_t pbuf_copy(struct pbuf *p_to, struct pbuf *p_from) @@ -727,11 +729,13 @@ pbuf_copy(struct pbuf *p_to, struct pbuf *p_from) /* don't copy more than one packet! */ LWIP_ASSERT("pbuf_copy() does not allow packet queues!\n", p_from->next == NULL); + return ERR_VAL; } if((p_to != NULL) && (p_to->len == p_to->tot_len)) { /* don't copy more than one packet! */ LWIP_ASSERT("pbuf_copy() does not allow packet queues!\n", p_to->next == NULL); + return ERR_VAL; } } while (p_from); LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE | 1, ("pbuf_copy: end of chain reached.\n"));