[lwip-devel] Problem with LWIP_ERROR in pbuf_header(..)
From:
Fredrik Hederstierna
Subject:
[lwip-devel] Problem with LWIP_ERROR in pbuf_header(..)
Date:
Fri, 24 Apr 2009 14:36:21 +0200
Hi
We have problems with getting LWIP_ERROR()
in function pbuf_header(..) in "pbuf.c"
The ASSERTING pbuf.c code looks like this,
line 429
if (header_size_increment < 0){
increment_magnitude = -header_size_increment;
/* Check
that we aren't going to move off the end of the pbuf */
-------->LWIP_ERROR("increment_magnitude
<= p->len", (increment_magnitude <= p->len), return 1;);
We suspect that its called from UDP code
in udp_input(..) line 102:
That is if incomming UDP packet is too
short, so the call to pbuf_header() will trig LWIP_ERROR?
Isn't it better to just drop illegal-size
packets instead of ASSERT?
What if header and header length is corrupted?
if (header_size_increment
< 0){
increment_magnitude
= -header_size_increment;
+#if 0
+ /* Can't assert these as
some callers speculatively call
+ pbuf_header()
to see if it's OK. Will return 1 below instead. */
/* Check that we aren't
going to move off the end of the pbuf */
LWIP_ERROR("increment_magnitude
<= p->len", (increment_magnitude <= p->len), return 1;);
+#endif
+ return 1;
} else {
increment_magnitude
= header_size_increment;
#if 0