[Top][All Lists]

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

[lwip-devel] [patch #8480] Fix handling of dns_seqno wraparound

From: Kevin Cernekee
Subject: [lwip-devel] [patch #8480] Fix handling of dns_seqno wraparound
Date: Sat, 14 Jun 2014 22:29:41 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:29.0) Gecko/20100101 Firefox/29.0


                 Summary: Fix handling of dns_seqno wraparound
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: cernekee
            Submitted on: Sat 14 Jun 2014 10:29:40 PM GMT
                Category: DNS
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None



In dns_enqueue(), lseq represents the number of DNS transactions that have
occurred since dns_table[lseqi] was started.  This should be a positive
number.  But gcc promotes (dns_seqno - pEntry->seqno) to a signed int, causing
lseq to be compared against negative values in some situations:

  dns_seqno = 1
  dns_table[0].seqno =   0, state = DNS_STATE_ASKING
  dns_table[1].seqno = 253, state = DNS_STATE_DONE
  dns_table[2].seqno = 254, state = DNS_STATE_DONE
  dns_table[3].seqno = 255, state = DNS_STATE_DONE

In this case, lseqi == 0 and the function returns ERR_MEM, despite the fact
that entries 1..3 are available for reuse.

Fix this by explicitly casting the "age" result to a u8_t.


File Attachments:

Date: Sat 14 Jun 2014 10:29:40 PM GMT  Name:
0001-dns-Fix-handling-of-dns_seqno-wraparound.patch  Size: 1kB   By: cernekee



Reply to this item at:


  Message sent via/by Savannah

reply via email to

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