buglwIP - A Lightweight TCP/IP stack - Bugs: bug #51729, lwip_itoa: fix converting 0

 
 

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

bug #51729: lwip_itoa: fix converting 0

Submitted by:  Joel Cunningham <jcunningham>
Submitted on:  Fri 11 Aug 2017 03:29:01 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: Faulty BehaviourStatus: Fixed
Privacy: PublicAssigned to: Simon Goldschmidt <goldsimon>
Open/Closed: ClosedPlanned Release: None
lwIP version: git head

Sat 23 Dec 2017 07:36:01 PM UTC, comment #5:

Fixed and added unit tests for lwip_itoa.

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Sat 23 Dec 2017 07:34:53 PM UTC, comment #4:

Right

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Tue 19 Dec 2017 12:07:24 PM UTC, comment #3:

lwip_itoa is still buggy! converting 0 is fixed (the bad way) but the following case still fail:

char buf[4];
lwip_itoa(buf, 4, 168);

It returns "68" in buf ! The same for 192. Returns "92" !

As it is use that way in mdns_build_reverse_v4_domain(), this result in BADLY encoded PTR answer in mDNS responder.

You may use an in-stack temporary buffer with enough space if required, but be able to convert numbers > 100 with a 4 char buffer.

Please re-open this bug.
Regards,
David

David GIRAULT <dgirault>
Fri 11 Aug 2017 06:40:36 PM UTC, comment #2:

Patch committed in 9844049cb181d296840cf1a0e718bf960ca67ceb

Joel Cunningham <jcunningham>
Project Member
Fri 11 Aug 2017 06:28:39 PM UTC, comment #1:

Looks good.

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Fri 11 Aug 2017 03:29:01 PM UTC, original submission:

Found that 0 can't be converted when passed to lwip_itoa. This was found via shell cmd idxtoname and win32 port. "lo0" should
be returned for index 1 (instead "lo" was returned)

Attached patch adds a special case check for 0 before starting the conversion while loop.

Joel Cunningham <jcunningham>
Project Member

 

Attached Files
file #42681:  lwip_itoa.patch added by dgirault (2KiB - text/x-patch - Patch)
file #41480:  0001-lwip_itoa-fix-converting-0.patch added by jcunningham (1KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by dgirault (Posted a comment)
  • -unavailable- added by goldsimon (Posted a comment)
  • -unavailable- added by jcunningham (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 9 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 23 Dec 2017 07:36:01 PM UTCgoldsimonStatusIn Progress=>Fixed
      Open/ClosedOpen=>Closed
    Sat 23 Dec 2017 07:34:53 PM UTCgoldsimonStatusFixed=>In Progress
      Assigned tojcunningham=>goldsimon
      Open/ClosedClosed=>Open
    Tue 19 Dec 2017 01:22:08 PM UTCdgiraultAttached File-=>Added lwip_itoa.patch, #42681
    Fri 11 Aug 2017 06:40:36 PM UTCjcunninghamStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Fri 11 Aug 2017 03:29:01 PM UTCjcunninghamAttached File-=>Added 0001-lwip_itoa-fix-converting-0.patch, #41480

    Back to the top


    Powered by Savane 3.1-cleanup1