summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2016-05-03 15:04:56 +0000
committerpfg <pfg@FreeBSD.org>2016-05-03 15:04:56 +0000
commit621e8ca862bb64d66caf591c46dd6fec98ac9008 (patch)
treef096e9678feb1739701e9e0608191b3a2d54f6ad /sbin
parent04acf11bf47629b82fc88ce0e6d6dc642b1e641b (diff)
downloadFreeBSD-src-621e8ca862bb64d66caf591c46dd6fec98ac9008.zip
FreeBSD-src-621e8ca862bb64d66caf591c46dd6fec98ac9008.tar.gz
MFC r298556:
ifconfig: prevent some improbable signed integer overflows. ic_nchans, from struct:ieee80211req_chaninfo, is an unsigned int. Use an unsigned index to prevent overflowing the index. Adopt unsigned integers in other cases where it is useful to be aware of the unsigned quantities and there is no risk of the values being negative.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/ifconfig/ifieee80211.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sbin/ifconfig/ifieee80211.c b/sbin/ifconfig/ifieee80211.c
index accb175..034d578 100644
--- a/sbin/ifconfig/ifieee80211.c
+++ b/sbin/ifconfig/ifieee80211.c
@@ -223,7 +223,7 @@ static int
canpromote(int i, int from, int to)
{
const struct ieee80211_channel *fc = &chaninfo->ic_chans[i];
- int j;
+ u_int j;
if ((fc->ic_flags & from) != from)
return i;
@@ -302,7 +302,7 @@ promote(int i)
static void
mapfreq(struct ieee80211_channel *chan, int freq, int flags)
{
- int i;
+ u_int i;
for (i = 0; i < chaninfo->ic_nchans; i++) {
const struct ieee80211_channel *c = &chaninfo->ic_chans[i];
@@ -322,7 +322,7 @@ mapfreq(struct ieee80211_channel *chan, int freq, int flags)
static void
mapchan(struct ieee80211_channel *chan, int ieee, int flags)
{
- int i;
+ u_int i;
for (i = 0; i < chaninfo->ic_nchans; i++) {
const struct ieee80211_channel *c = &chaninfo->ic_chans[i];
@@ -2939,7 +2939,7 @@ copy_essid(char buf[], size_t bufsize, const u_int8_t *essid, size_t essid_len)
{
const u_int8_t *p;
size_t maxlen;
- int i;
+ u_int i;
if (essid_len > bufsize)
maxlen = bufsize;
@@ -4133,7 +4133,7 @@ static void
printkey(const struct ieee80211req_key *ik)
{
static const uint8_t zerodata[IEEE80211_KEYBUF_SIZE];
- int keylen = ik->ik_keylen;
+ u_int keylen = ik->ik_keylen;
int printcontents;
printcontents = printkeys &&
@@ -4170,7 +4170,7 @@ printkey(const struct ieee80211req_key *ik)
break;
}
if (printcontents) {
- int i;
+ u_int i;
printf(" <");
for (i = 0; i < keylen; i++)
OpenPOWER on IntegriCloud