public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] 'id' rollover bug in dns.c
@ 2009-10-01 23:11 Will Lentz
  2009-10-01 23:37 ` Jay Foster
  0 siblings, 1 reply; 6+ messages in thread
From: Will Lentz @ 2009-10-01 23:11 UTC (permalink / raw)
  To: ecos-discuss

Hi,
 
There is a rollover bug in the current CVS copy of dns.c. Around line
237 there is the following code:
            /* Reply to an old query. Ignore it */
            if (ntohs(dns_hdr->id) != (id-1)) {

If dns_hdr->id == 5 and id == 6, then the 'if' condition is false as
expected.

If dns_hdr->id == 0xFFFF and id == 0, then the 'if' condition is
incorrectly true.

The simple patch below fixes the issue:
--- dns_old.c   2009-10-01 16:01:41.000000000 -0700
+++ dns.c       2009-10-01 16:01:45.000000000 -0700
@@ -234,7 +234,7 @@
             }

             /* Reply to an old query. Ignore it */
-            if (ntohs(dns_hdr->id) != (id-1)) {
+            if (ntohs(dns_hdr->id) != (cyg_uint16)(id-1)) {
                 continue;
             }
             finished = true;


Cheers,
Will

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-10-05 15:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-01 23:11 [ECOS] 'id' rollover bug in dns.c Will Lentz
2009-10-01 23:37 ` Jay Foster
2009-10-01 23:53   ` Will Lentz
2009-10-02  0:15   ` Will Lentz
2009-10-02  1:11     ` Jay Foster
2009-10-05 15:50       ` Will Lentz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).