[Dnsmasq-discuss] integer overflow in src/dnsmasq.h ?!
Stefan Krüger
stadtkind2 at gmx.de
Tue Jun 17 17:23:49 BST 2008
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
TIA
More information about the Dnsmasq-discuss
mailing list