提交 2dcc26e3 编写于 作者: D Dan Carpenter 提交者: John W. Linville

ray_cs: read past the end of the array

"translate" should either be set or disabled.  We also use it an
offset into the framing[] array when we're generating the proc
file.  Framing looks like this:

static const char *framing[] = { "Encapsulation", "Translation" }

So when we're setting translate we need to restrict the values to
either 1 or 0 or it can an out of bounds read.
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 88cceab5
...@@ -144,7 +144,7 @@ static int psm; ...@@ -144,7 +144,7 @@ static int psm;
static char *essid; static char *essid;
/* Default to encapsulation unless translation requested */ /* Default to encapsulation unless translation requested */
static int translate = 1; static bool translate = 1;
static int country = USA; static int country = USA;
...@@ -178,7 +178,7 @@ module_param(hop_dwell, int, 0); ...@@ -178,7 +178,7 @@ module_param(hop_dwell, int, 0);
module_param(beacon_period, int, 0); module_param(beacon_period, int, 0);
module_param(psm, int, 0); module_param(psm, int, 0);
module_param(essid, charp, 0); module_param(essid, charp, 0);
module_param(translate, int, 0); module_param(translate, bool, 0);
module_param(country, int, 0); module_param(country, int, 0);
module_param(sniffer, int, 0); module_param(sniffer, int, 0);
module_param(bc, int, 0); module_param(bc, int, 0);
...@@ -1353,7 +1353,7 @@ static int ray_get_range(struct net_device *dev, struct iw_request_info *info, ...@@ -1353,7 +1353,7 @@ static int ray_get_range(struct net_device *dev, struct iw_request_info *info,
static int ray_set_framing(struct net_device *dev, struct iw_request_info *info, static int ray_set_framing(struct net_device *dev, struct iw_request_info *info,
union iwreq_data *wrqu, char *extra) union iwreq_data *wrqu, char *extra)
{ {
translate = *(extra); /* Set framing mode */ translate = !!*(extra); /* Set framing mode */
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册