Change i_len in ieee80211req to be unsigned and fix other signed/unsigned

issues. From Dan Rosenberg (drosenberg at vsecurity dot com).
This commit is contained in:
christos 2011-06-12 00:07:19 +00:00
parent 7267577190
commit 6793b1da06
3 changed files with 14 additions and 12 deletions

View File

@ -34,7 +34,7 @@
__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_acl.c,v 1.4 2005/08/13 17:31:48 sam Exp $");
#endif
#ifdef __NetBSD__
__KERNEL_RCSID(0, "$NetBSD: ieee80211_acl.c,v 1.8 2008/12/17 20:51:37 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: ieee80211_acl.c,v 1.9 2011/06/12 00:07:19 christos Exp $");
#endif
/*
@ -79,7 +79,7 @@ struct acl {
struct aclstate {
acl_lock_t as_lock;
int as_policy;
int as_nacls;
uint32_t as_nacls;
TAILQ_HEAD(, acl) as_list; /* list of all ACL's */
LIST_HEAD(, acl) as_hash[ACL_HASHSIZE];
struct ieee80211com *as_ic;
@ -281,7 +281,8 @@ acl_getioctl(struct ieee80211com *ic, struct ieee80211req *ireq)
struct aclstate *as = ic->ic_as;
struct acl *acl;
struct ieee80211req_maclist *ap;
int error, space, i;
int error;
uint32_t i, space;
switch (ireq->i_val) {
case IEEE80211_MACCMD_POLICY:

View File

@ -1,4 +1,4 @@
/* $NetBSD: ieee80211_ioctl.c,v 1.55 2011/04/02 08:11:32 mbalmer Exp $ */
/* $NetBSD: ieee80211_ioctl.c,v 1.56 2011/06/12 00:07:19 christos Exp $ */
/*-
* Copyright (c) 2001 Atsushi Onoe
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@ -36,7 +36,7 @@
__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_ioctl.c,v 1.35 2005/08/30 14:27:47 avatar Exp $");
#endif
#ifdef __NetBSD__
__KERNEL_RCSID(0, "$NetBSD: ieee80211_ioctl.c,v 1.55 2011/04/02 08:11:32 mbalmer Exp $");
__KERNEL_RCSID(0, "$NetBSD: ieee80211_ioctl.c,v 1.56 2011/06/12 00:07:19 christos Exp $");
#endif
/*
@ -932,9 +932,8 @@ ieee80211_ioctl_getchanlist(struct ieee80211com *ic, struct ieee80211req *ireq)
{
size_t len = ireq->i_len;
if (sizeof(ic->ic_chan_active) < len) {
if (len > sizeof(ic->ic_chan_active))
len = sizeof(ic->ic_chan_active);
}
return copyout(&ic->ic_chan_active, ireq->i_data, len);
}
@ -942,7 +941,8 @@ static int
ieee80211_ioctl_getchaninfo(struct ieee80211com *ic, struct ieee80211req *ireq)
{
struct ieee80211req_chaninfo *chans;
int i, space, error;
uint32_t i, space;
int error;
/*
* Since channel 0 is not available for DS, channel 1
@ -1004,7 +1004,7 @@ ieee80211_ioctl_getstastats(struct ieee80211com *ic, struct ieee80211req *ireq)
{
struct ieee80211_node *ni;
u_int8_t macaddr[IEEE80211_ADDR_LEN];
const int off = __offsetof(struct ieee80211req_sta_stats, is_stats);
const size_t off = __offsetof(struct ieee80211req_sta_stats, is_stats);
int error;
if (ireq->i_len < off)
@ -1075,7 +1075,8 @@ ieee80211_ioctl_getscanresults(struct ieee80211com *ic, struct ieee80211req *ire
struct ieee80211req_scan_result *sr = &u.res;
struct ieee80211_node_table *nt;
struct ieee80211_node *ni;
int error, space;
int error;
uint32_t space;
u_int8_t *p, *cp;
p = ireq->i_data;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ieee80211_ioctl.h,v 1.19 2008/07/28 17:54:02 christos Exp $ */
/* $NetBSD: ieee80211_ioctl.h,v 1.20 2011/06/12 00:07:19 christos Exp $ */
/*-
* Copyright (c) 2001 Atsushi Onoe
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@ -413,7 +413,7 @@ struct ieee80211req {
char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */
u_int16_t i_type; /* req type */
int16_t i_val; /* Index or simple value */
int16_t i_len; /* Index or simple value */
u_int16_t i_len; /* Index or simple value */
void *i_data; /* Extra data */
};