2009-01-10 01:17:44

by Colin McCabe

[permalink] [raw]
Subject: [PATCH] iw: Fix regression in mesh_param input parsing

In the iw tool, don't crash on bad arguments to "iw dev mesh set mesh_param"

---
mesh.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/mesh.c b/mesh.c
index d6edf3f..f663363 100644
--- a/mesh.c
+++ b/mesh.c
@@ -192,9 +192,10 @@ static const struct mesh_param_descr* find_mesh_param(int argc, char **argv,

/* Find out what mesh parameter we want to change. */
mdescr = NULL;
- for (i = 0; ARRAY_SIZE(_mesh_param_descrs); i++)
+ for (i = 0; i < ARRAY_SIZE(_mesh_param_descrs); i++) {
if (!strcmp(_mesh_param_descrs[i].name, argv[0]))
return _mesh_param_descrs + i;
+ }

if (!mdescr) {
printf("Mesh_param must be one of: ");
--
1.5.6.3



2009-01-10 09:13:23

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] iw: Fix regression in mesh_param input parsing

On Fri, 2009-01-09 at 17:13 -0800, Colin McCabe wrote:
> In the iw tool, don't crash on bad arguments to "iw dev mesh set mesh_param"
>
> ---
> mesh.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/mesh.c b/mesh.c
> index d6edf3f..f663363 100644
> --- a/mesh.c
> +++ b/mesh.c
> @@ -192,9 +192,10 @@ static const struct mesh_param_descr* find_mesh_param(int argc, char **argv,
>
> /* Find out what mesh parameter we want to change. */
> mdescr = NULL;
> - for (i = 0; ARRAY_SIZE(_mesh_param_descrs); i++)
> + for (i = 0; i < ARRAY_SIZE(_mesh_param_descrs); i++) {
> if (!strcmp(_mesh_param_descrs[i].name, argv[0]))
> return _mesh_param_descrs + i;
> + }

Ouch, sorry about that! Merged the patch, thanks.

johannes


Attachments:
signature.asc (836.00 B)
This is a digitally signed message part