[uClibc]problem in __dns_lookup (resolv.c)

Cho, Seong-Myun smcho at xecurenexus.com
Thu Oct 31 02:30:09 UTC 2002


--- resolv.c.org        Thu Oct 31 11:03:49 2002
+++ resolv.c    Thu Oct 31 11:04:33 2002
@@ -641,7 +641,9 @@
 
                /* Mess with globals while under lock */
                LOCK;
-               h.id = ++id;
+               ++id;
+               id &= 0xffff;
+               h.id = id;
                dns = nsip[ns];
                UNLOCK;

The above patch should be applied to resolv.c

because __encode_header/__decode_header only deal with the lower 16 bits of 'id',
when 'id' is greater than 0xffff, the following code has a problem. ('h.id' cannot be equal to 'id'.)

                LOCK; 
                if ((h.id != id) || (!h.qr)) {
                        UNLOCK;
                        /* unsolicited */
                        goto again;
                }
                UNLOCK;



More information about the uClibc mailing list