buglwIP - A Lightweight TCP/IP stack - Bugs: bug #20237, pbuf memory corruption

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #20237: pbuf memory corruption

Submitter:  Spark Jon <sparkjon>
Submitted:  Fri 22 Jun 2007 08:48:37 AM UTC
   
 
Category:  pbufs Severity:  3 - Normal
Item Group:  Crash Error Status:  Invalid
Privacy:  Public Assigned to:  None
Open/Closed:  Closed Planned Release:  None
lwIP version:  None

Fri 22 Jun 2007 10:37:59 AM UTC, comment #3: 

There is also an assert for checking it doesn't overflow.

Closing this as invalid.

Simon Goldschmidt <goldsimon>
Group administrator
Fri 22 Jun 2007 10:03:51 AM UTC, comment #2: 

Sorry, Yes, I'm using v1.2.0.

Spark Jon <sparkjon>
Fri 22 Jun 2007 08:57:40 AM UTC, comment #1: 

As far as I know, this is already fixed in CVS HEAD:

>>> code from CVS HEAD >>>

p->len = length > PBUF_POOL_BUFSIZE - LWIP_MEM_ALIGN_SIZE(offset)? PBUF_POOL_BUFSIZE - LWIP_MEM_ALIGN_SIZE(offset): length;
<<< code from CVS HEAD <<<

I'm guessing you are using v1.2.0 or previous, not CVS HEAD?

Simon Goldschmidt <goldsimon>
Group administrator
Fri 22 Jun 2007 08:48:37 AM UTC, original submission:  

pbuf.c - pbuf_alloc()

The pbuf corrupts the next pbuf under the following conditions,
1. If the p->payload been aligned and moved.
p->payload = MEM_ALIGN((void )((u8_t )p + (sizeof(struct pbuf) + offset)));

2. length > PBUF_POOL_BUFSIZE - offset
p->len = length > PBUF_POOL_BUFSIZE - offset ?
PBUF_POOL_BUFSIZE - offset : length;

The following code fragment fixed the alignment problem which cause the p->payload + p->len over the range of pbuf, and the later data write to p->payload address with p->len will overwrite the p->next value.

/* set the length of the first pbuf in the chain */
pbuf_end = (u32)p + sizeof(struct pbuf) + PBUF_POOL_BUFSIZE;   
p->len = length > pbuf_end - (u32)p->payload ? pbuf_end - (u32)p->payload : length;




Spark Jon <sparkjon>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by goldsimon (Posted a comment)
  • -email is unavailable- added by sparkjon (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-06-22 goldsimon StatusNone Invalid
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code