buglwIP - A Lightweight TCP/IP stack - Bugs: bug #41775, DNS_MAX_NAME_LENGTH is not valid...


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

bug #41775: DNS_MAX_NAME_LENGTH is not valid compare value for strlen

Submitted by:  David Bydeley <dbydeley>
Submitted on:  Wed 05 Mar 2014 02:16:24 AM UTC  
Category:  DNS Severity:  3 - Normal
Item Group:  Faulty Behaviour Status:  Duplicate
Privacy:  Public Assigned to:  Simon Goldschmidt <goldsimon>
Open/Closed:  Closed Planned Release:  None
lwIP version:  1.4.1

Tue 02 Sep 2014 07:39:20 PM UTC, comment #1: 

This is a duplicate to bug #37705 Possible memory corruption in DNS query, already fixed in git master a year and a half ago.

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Wed 05 Mar 2014 02:16:24 AM UTC, original submission:  

Function dns_gethostbyname uses DNS_MAX_NAME_LENGTH to check if the provided string name is not too long.
(strlen(hostname) >= DNS_MAX_NAME_LENGTH)

Function dns_send uses DNS_MAX_NAME_LENGTH to allocate a packet buffer large enough to hold the query format of the name.

While the string check in dns_gethostbyname does cover for the needed NULL termination (>=) it does not account for the additional first segment length byte at the beginning of the DNS name query.

Therefor a hostname string of DNS_MAX_NAME_LENGTH-1 will pass the check in dns_gethostbyname, but will result in an overrun of one character when you "convert hostname into suitable query format" in dns_send.

David Bydeley <dbydeley>


No files currently attached


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 dbydeley (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-09-02 goldsimon StatusNone => Duplicate
        Assigned toNone => goldsimon
        Open/ClosedOpen => Closed

    Back to the top

    Powered by Savane 3.5