diff options
author | jlemon <jlemon@FreeBSD.org> | 2000-05-17 04:05:07 +0000 |
---|---|---|
committer | jlemon <jlemon@FreeBSD.org> | 2000-05-17 04:05:07 +0000 |
commit | e68744c276af9de9015738be8aa647a092816b0e (patch) | |
tree | 0df6ba321be849dfbf5048145da4cf9732ee2b4c /sys/netinet | |
parent | b987a44176b0842184c50b2b8bef55a7e0e762a9 (diff) | |
download | FreeBSD-src-e68744c276af9de9015738be8aa647a092816b0e.zip FreeBSD-src-e68744c276af9de9015738be8aa647a092816b0e.tar.gz |
Cast sizeof() calls to be of type (int) when they appear in a signed
integer expression. Otherwise the sizeof() call will force the expression
to be evaluated as unsigned, which is not the intended behavior.
Obtained from: NetBSD (in a different form)
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/ip_input.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index b3d3c4a..763674c 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -1126,7 +1126,7 @@ ip_dooptions(m) break; } off--; /* 0 origin */ - if (off > optlen - sizeof(struct in_addr)) { + if (off > optlen - (int)sizeof(struct in_addr)) { /* * End of source route. Should be for us. */ @@ -1197,7 +1197,7 @@ nosourcerouting: * If no space remains, ignore. */ off--; /* 0 origin */ - if (off > optlen - sizeof(struct in_addr)) + if (off > optlen - (int)sizeof(struct in_addr)) break; (void)memcpy(&ipaddr.sin_addr, &ip->ip_dst, sizeof(ipaddr.sin_addr)); @@ -1221,7 +1221,8 @@ nosourcerouting: ipt = (struct ip_timestamp *)cp; if (ipt->ipt_len < 5) goto bad; - if (ipt->ipt_ptr > ipt->ipt_len - sizeof(int32_t)) { + if (ipt->ipt_ptr > + ipt->ipt_len - (int)sizeof(int32_t)) { if (++ipt->ipt_oflw == 0) goto bad; break; |