buglwIP - A Lightweight TCP/IP stack - Bugs: bug #19443, pcb allocations in api_msg are not...

 
 

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

bug #19443: pcb allocations in api_msg are not always checked (and code is redundant)

Submitted by:  Frédéric Bernon <fbernon>
Submitted on:  Thu 29 Mar 2007 12:38:34 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: Crash ErrorStatus: Fixed
Privacy: PublicAssigned to: Frédéric Bernon <fbernon>
Open/Closed: ClosedPlanned Release: None
lwIP version: None

Fri 30 Mar 2007 08:25:55 AM UTC, comment #4:

The patch is a little hard to follow (not because of anything you've done, just because diff has tried to match up bits of code that aren't the same I think) but I think it should be OK if it does what you said it would.

Kieran Mansley <kieranm>
Project Administrator
Thu 29 Mar 2007 06:19:26 PM UTC, comment #3:

Patch file attached.

(file #12333)

Frédéric Bernon <fbernon>
Project MemberIn charge of this item.
Thu 29 Mar 2007 12:58:29 PM UTC, comment #2:

static err_t pcb_new(struct api_msg_msg *msg)?

Frédéric Bernon <fbernon>
Project MemberIn charge of this item.
Thu 29 Mar 2007 12:51:43 PM UTC, comment #1:

Good idea.

Only comment would be call it something other than do_newpcb() - that name suggests you can invoke it by sending a "NEWPCB" message through the api, whereas this is just a little helper function for some of the other do_* functions.

Kieran Mansley <kieranm>
Project Administrator
Thu 29 Mar 2007 12:38:34 PM UTC, original submission:

If you look do_newconn, do_bind, and do_connect, you will see that there is lot of redundant code: we alloc a pcb if it doesn't exist before. More, most of "xxx_new" are not checked (in do_bind, and for raw_new), and can cause a crash. I propose to add a new function named do_newpcb which return ERR_MEM if there is an error, and to use it in do_newconn, do_bind, and do_connect. Footprint will be reduced, checking "xx_new" will be done once time, and maintain or review this file will be simpler.

I prepare a patch for that...

Frédéric Bernon <fbernon>
Project MemberIn charge of this item.

 

Attached Files
file #12333:  pcb_new.patch added by fbernon (6KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by kieranm (Posted a comment)
  • -unavailable- added by fbernon (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 30 Mar 2007 12:42:37 PM UTCfbernonStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Thu 29 Mar 2007 06:19:26 PM UTCfbernonAttached File-=>Added pcb_new.patch, #12333

    Back to the top


    Powered by Savane 3.1-cleanup1