mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-28 00:15:16 +00:00
Added check: PBUF_POOL_BUFSIZE must be greater than MEM_ALIGNMENT or else the offset of a pbuf may take the full first pbuf in a chain (resulting in the first pbuf having len==0)
This commit is contained in:
parent
ea1eb45e3f
commit
7b6c11360f
@ -155,6 +155,9 @@
|
||||
#if (MEM_USE_POOLS && !MEMP_USE_CUSTOM_POOLS)
|
||||
#error "MEM_USE_POOLS requires custom pools (MEMP_USE_CUSTOM_POOLS) to be enabled in your lwipopts.h"
|
||||
#endif
|
||||
#if (PBUF_POOL_BUFSIZE <= MEM_ALIGNMENT)
|
||||
#error "PBUF_POOL_BUFSIZE must be grater than MEM_ALIGNMENT or the offset may take the full first pbuf"
|
||||
#endif
|
||||
|
||||
|
||||
/* Compile-time checks for deprecated options.
|
||||
|
@ -200,6 +200,7 @@ pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type)
|
||||
LWIP_ASSERT("check p->payload + p->len does not overflow pbuf",
|
||||
((u8_t*)p->payload + p->len <=
|
||||
(u8_t*)p + SIZEOF_STRUCT_PBUF + PBUF_POOL_BUFSIZE_ALIGNED));
|
||||
LWIP_ASSERT("PBUF_POOL_BUFSIZE must be bigger than MEM_ALIGNMENT", p->len != 0);
|
||||
/* set reference count (needed here in case we fail) */
|
||||
p->ref = 1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user