[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] [bug #35907] lwip_gethostbyname_r returns an invalid h_addr

From: Mason
Subject: [lwip-devel] [bug #35907] lwip_gethostbyname_r returns an invalid h_addr_list
Date: Tue, 20 Mar 2012 14:20:53 +0000
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:10.0.2) Gecko/20120216 Firefox/10.0.2 SeaMonkey/2.7.2


                 Summary: lwip_gethostbyname_r returns an invalid h_addr_list
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: mason
            Submitted on: Tue 20 Mar 2012 02:20:52 PM GMT
                Category: sockets
                Severity: 3 - Normal
              Item Group: Faulty Behaviour
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: 
            lwIP version: 1.4.0



(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
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
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.



File Attachments:

Date: Tue 20 Mar 2012 02:20:52 PM GMT  Name: netdb.patch  Size: 1kB   By:



Reply to this item at:


  Message sent via/by Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]