public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: "Will Lentz" <Will_Lentz@Trimble.com>
To: <ecos-discuss@ecos.sourceware.org>
Subject: [ECOS] 'id' rollover bug in dns.c
Date: Thu, 01 Oct 2009 23:11:00 -0000	[thread overview]
Message-ID: <A5EF2F2B9D31734CB122F378C1ADB5CB0236ED09@uss-am-xch-02.am.trimblecorp.net> (raw)

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

             reply	other threads:[~2009-10-01 23:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-01 23:11 Will Lentz [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=A5EF2F2B9D31734CB122F378C1ADB5CB0236ED09@uss-am-xch-02.am.trimblecorp.net \
    --to=will_lentz@trimble.com \
    --cc=ecos-discuss@ecos.sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).