[Top][All Lists]

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

[lwip-devel] [bug #63547] lwip_gethostbyname() bug fix

From: Abhik Roy
Subject: [lwip-devel] [bug #63547] lwip_gethostbyname() bug fix
Date: Mon, 19 Dec 2022 03:17:33 -0500 (EST)


                 Summary: lwip_gethostbyname() bug fix
                 Project: lwIP - A Lightweight TCP/IP stack
               Submitter: abhikroy
               Submitted: Mon 19 Dec 2022 08:17:31 AM UTC
                Category: IPv4
                Severity: 3 - Normal
              Item Group: Faulty Behaviour
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None
            lwIP version: 2.1.3


Follow-up Comments:

Date: Mon 19 Dec 2022 08:17:31 AM UTC By: Abhik Roy <abhikroy>
In src/api/netdb.c struct hostent *lwip_gethostbyname(const char *name)
line No 117, the lwip_gethostbyname() function returns the wrong h_length.
i.e for an IPv4 address passed to lwip_gethostbyname() the returned h_length
should be 4. Instead, the returned value is 24.

Also, In case an IPv6 address is passed to lwip_gethostbyname() the returned
h_addrtype is hard coded to AF_INET.

The changes submitted address these issues by using IP_ADDR_RAW_SIZE() macro
to get the correct size. and checks the  address type with IP_GET_TYPE() macro
and then returning AF_INET or AF_INET6 accordingly. 


Reply to this item at:


Message sent via Savannah

reply via email to

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