[Dnsmasq-discuss] integer overflow in src/dnsmasq.h ?!

Simon Kelley simon at thekelleys.org.uk
Tue Jun 17 20:28:09 BST 2008


Stefan Krüger wrote:
> hello list,
> 
> I'm trying to compile dnsmasq (2.43test4) with Sun Studio 12 on
> Solaris10/sparc.
> 
> I got some warnings, like:
> 
> cc -g -errtags=yes     -DSUNOS_VER=10  -c rfc1035.c
> "rfc1035.c", line 779: warning: integer overflow detected: op "<<"
> (E_INTEGER_OVERFLOW_DETECTED)
> 
> line 779 in rfc1035.c is
> 
> if ((daemon->options & OPT_NO_REBIND) &&
>     (flags & F_IPV4) &&
>      private_net(addr.addr.addr4))
>     return 1;
> 
> I checked OPT_NO_REBIND which is defined in src/dnsmasq.h
> 
> #define OPT_NO_REBIND      (1<<31)
> 
> which looks indeed like an integer overflow.
> 
> So my question, is this warning serious? Could I fix it like:
> 
> #define OPT_NO_REBIND      (1u<<31)
> 
> ?
> 
> The next error was:
> 
> cc -g -errtags=yes -errwarn=%all     -DSUNOS_VER=10  -c option.c
> "option.c", line 302: warning: initializer does not fit or is out of
> range: 0x80000000 (E_INIT_DOES_NOT_FIT)
> 
> I fixed this by changing int to unsigned in src/option.c (line 209):
> 
> static struct {
>   unsigned int opt, rept;
>   ...
> 
> I also had some problems with __sun__ #defines, which don't work with 
> Sun Studio 12's cc, I had to replace them with __sun
> 

Thanks for that, I applied your fixes and the result is available as

http://www.thekelleys.org.uk/dnsmasq/test-releases/dnsmasq-2.43test6.tar.gz

please let me know if there are any other problems.

Cheers,

Simon.


> TIA
> 
> _______________________________________________
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
> 




More information about the Dnsmasq-discuss mailing list