This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
'id' rollover bug in dns.c
- From: "Will Lentz" <Will_Lentz at Trimble dot com>
- To: <ecos-discuss at ecos dot sourceware dot org>
- Date: Thu, 1 Oct 2009 16:11:01 -0700
- Subject: [ECOS] 'id' rollover bug in dns.c
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