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

Submitter:  Mason <mason>
Submitted:  Tue 20 Mar 2012 02:20:52 PM UTC
   
 
Category:  sockets/netconn Severity:  3 - Normal
Item Group:  Faulty Behaviour Status:  Fixed
Privacy:  Public Assigned to:  goldsimon
Open/Closed:  Closed Planned 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>
Group administrator
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>
Group Member
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>

 

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

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
  • -email is unavailable- added by goldsimon (Posted a comment)
  • -email is unavailable- added by kieranm (Posted a comment)
  • -email is unavailable- added by mason (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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-03-20 goldsimon StatusNone Fixed
        Assigned toNone goldsimon
        Open/ClosedOpen Closed
    2012-03-20 kieranm Planned Release 1.4.1
    2012-03-20 mason Attached File- Added patch_netdb.txt, #25417
    2012-03-20 mason Attached File- Added netdb.patch, #25416

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code