From: Steve Brown <sbrown@cortland.com>
To: Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH v2] mesh: Fix crash while reading input parameters
Date: Sun, 10 Dec 2017 03:58:39 -0700 [thread overview]
Message-ID: <1512903519.27989.19.camel@ewol.com> (raw)
In-Reply-To: <20171208171230.11069-1-luiz.dentz@gmail.com>
Hi Luiz,
On Fri, 2017-12-08 at 15:12 -0200, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> read_input_parameters skips the command argument thus arg[0] shall be
> considerer the fist argument.
> ---
> mesh/config-client.c | 5 ++++-
> mesh/onoff-model.c | 5 ++++-
> 2 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/mesh/config-client.c b/mesh/config-client.c
> index 7aabe6ce7..3d618b6a6 100644
> --- a/mesh/config-client.c
> +++ b/mesh/config-client.c
> @@ -229,10 +229,13 @@ static uint32_t read_input_parameters(int argc,
> char *argv[])
> {
> uint32_t i;
>
> + if (!argc)
> + return 0;
> +
> --argc;
> ++argv;
>
> - if (!argc || argv[1][0] == '\0')
> + if (!argc || argv[0][0] == '\0')
> return 0;
>
> memset(parms, 0xff, sizeof(parms));
> diff --git a/mesh/onoff-model.c b/mesh/onoff-model.c
> index 9c8869414..fc0d64617 100644
> --- a/mesh/onoff-model.c
> +++ b/mesh/onoff-model.c
> @@ -152,10 +152,13 @@ static uint32_t read_input_parameters(int argc,
> char *argv[])
> {
> uint32_t i;
>
> + if (!argc)
> + return 0;
> +
> --argc;
> ++argv;
>
> - if (!argc || argv[1][0] == '\0')
> + if (!argc || argv[0][0] == '\0')
> return 0;
>
> memset(parms, 0xff, sizeof(parms));
I tested both config and onoff.
Both fixed.
Thanks,
Steve
next prev parent reply other threads:[~2017-12-10 10:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-08 17:12 [PATCH v2] mesh: Fix crash while reading input parameters Luiz Augusto von Dentz
2017-12-10 10:58 ` Steve Brown [this message]
2017-12-11 9:20 ` Johan Hedberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1512903519.27989.19.camel@ewol.com \
--to=sbrown@cortland.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.