buglwIP - A Lightweight TCP/IP stack - Bugs: bug #35907, lwip_gethostbyname_r returns an...

 
 

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

bug #35907: lwip_gethostbyname_r returns an invalid h_addr_list

Submitted by:  Mason <mason>
Submitted on:  Tue 20 Mar 2012 02:20:52 PM UTC  
 
Category: sockets/netconnSeverity: 3 - Normal
Item Group: Faulty BehaviourStatus: Fixed
Privacy: PublicAssigned to: Simon Goldschmidt <goldsimon>
Open/Closed: ClosedPlanned Release: None
lwIP version: 1.4.0

Tue 20 Mar 2012 09:08:20 PM UTC, comment #2:

Double-checked and committed to both master and DEVEL-1_4_1 branches.
Thanks for reporting.

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Tue 20 Mar 2012 08:10:51 PM UTC, comment #1:

Sounds sensible. If anyone can look this over it would be nice to get this in to 1.4.1

Kieran Mansley <kieranm>
Project Administrator
Tue 20 Mar 2012 02:20:52 PM UTC, original submission:

(I picked lwip version "1.4.0" because "1.4.1-branch" is not available)

According to the definition of struct hostent, the h_addr_list field must be
"a pointer to an array of pointers to network addresses (in network byte order)
for the host, terminated by a null pointer."

Currently (lwip 1.4.1 branch) h_addr_list does not point to an array at all,
which leads to a crash in libcurl :-(

(gdb) p *h
$3 = {
h_name = 0x82498a30 "www.google.com",
h_aliases = 0x82498a2c,
h_addrtype = 2,
h_length = 4,
h_addr_list = 0x82498a24
}
(gdb) p h->h_addr_list
$4 = (char **) 0x82498a24
(gdb) p h->h_addr_list[0]
$5 = 0x82498a28 "ÐUôh"
(gdb) p h->h_addr_list[1]
$6 = 0x689355d1

The proposed patch modifies struct gethostbyname_r_helper, such that addr_list
is an array of 2 pointers to network addresses, addr_list[0] pointing to the
actual address "addr" and addr_list[1] being the array's NULL terminator.

Comments?

Mason <mason>

 

Attached Files
file #25417:  patch_netdb.txt added by mason (1KiB - text/plain - Use txt extension to prevent application/octet-stream MIME type?)
file #25416:  netdb.patch added by mason (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 goldsimon (Posted a comment)
  • -unavailable- added by kieranm (Posted a comment)
  • -unavailable- added by mason (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 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 20 Mar 2012 09:08:20 PM UTCgoldsimonStatusNone=>Fixed
      Assigned toNone=>goldsimon
      Open/ClosedOpen=>Closed
    Tue 20 Mar 2012 08:10:51 PM UTCkieranmPlanned Release=>1.4.1
    Tue 20 Mar 2012 02:25:16 PM UTCmasonAttached File-=>Added patch_netdb.txt, #25417
    Tue 20 Mar 2012 02:20:52 PM UTCmasonAttached File-=>Added netdb.patch, #25416

    Back to the top


    Powered by Savane 3.1-cleanup1