buglwIP - A Lightweight TCP/IP stack - Bugs: bug #63547, lwip_gethostbyname() bug fix


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

bug #63547: lwip_gethostbyname() bug fix

Submitter:  Abhik Roy <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 Planned Release:  None
lwIP version:  2.1.3

Mon 19 Dec 2022 08:17:31 AM UTC, original submission:  

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.

Abhik Roy <abhikroy>


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

Attached Files
file #54125:  lwip_gethostbyname_bug_fix.patch added by abhikroy (555B - 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 abhikroy (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.


    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-12-19 abhikroy Attached File- Added lwip_gethostbyname_bug_fix.patch, #54125

    Back to the top

    Powered by Savane 3.13-12ab.
    Corresponding source code