Warning implies possible kerberos bug in krb5int_dns_nextans() in dnsglue.c

Russ Allbery rra at stanford.edu
Mon Mar 17 20:21:47 EDT 2008


"Marus, Dennis" <Dennis.Marus at xerox.com> writes:

> When compiling this file (using Windriver's PPC compiler) the following
> warning is given;
>
> dnsglue.c:317: warning: comparison is always false due to limited range
> of data type
>
> The line of code causing the problem is;
>
>             if (rdlen > INT_MAX)
>
> Where rdlen has been defined as an unsigned short and INT_MAX is set to
> 0x7fffffffL
>
> Since rdlen is the length to be read and is set by a call to the
> SAFE_GETUINT16 macro, can any value really be considered invalid? 

What if you have a host with 16-bit ints and an unsigned value larger than
2^15-1?

> It might be that rdlen could be set to an int just like ds->anslen which
> will resolve the warning, but I'm uncertain as to the validity of that
> change.

There isn't anything wrong with the above code so far as I can see.  It
just produces a harmless warning on hosts where sizeof(short) <
sizeof(int).

-- 
Russ Allbery (rra at stanford.edu)             <http://www.eyrie.org/~eagle/>



More information about the krbdev mailing list