* [PATCH] android/client: Fix incorrect memory access
@ 2014-08-26 13:42 Andrei Emeltchenko
2014-08-29 13:58 ` Szymon Janc
0 siblings, 1 reply; 2+ messages in thread
From: Andrei Emeltchenko @ 2014-08-26 13:42 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
In case argc==3 we might access argv[3]. Make code more readable.
---
android/client/if-hf.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/android/client/if-hf.c b/android/client/if-hf.c
index d0e7a66..77216df 100644
--- a/android/client/if-hf.c
+++ b/android/client/if-hf.c
@@ -576,7 +576,7 @@ static void at_response_c(int argc, const char **argv, enum_func *enum_func,
static void at_response_p(int argc, const char **argv)
{
bthf_at_response_t response_code;
- int error_code = 0;
+ int error_code;
RETURN_IF_NULL(if_hf);
@@ -588,7 +588,9 @@ static void at_response_p(int argc, const char **argv)
response_code = str2bthf_at_response_t(argv[2]);
/* error code */
- if (argc >= 3)
+ if (argc <= 3)
+ error_code = 0;
+ else
error_code = atoi(argv[3]);
EXEC(if_hf->at_response, response_code, error_code);
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] android/client: Fix incorrect memory access
2014-08-26 13:42 [PATCH] android/client: Fix incorrect memory access Andrei Emeltchenko
@ 2014-08-29 13:58 ` Szymon Janc
0 siblings, 0 replies; 2+ messages in thread
From: Szymon Janc @ 2014-08-29 13:58 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
Hi Andrei,
On Tuesday 26 of August 2014 16:42:19 Andrei Emeltchenko wrote:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> In case argc==3 we might access argv[3]. Make code more readable.
> ---
> android/client/if-hf.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/android/client/if-hf.c b/android/client/if-hf.c
> index d0e7a66..77216df 100644
> --- a/android/client/if-hf.c
> +++ b/android/client/if-hf.c
> @@ -576,7 +576,7 @@ static void at_response_c(int argc, const char **argv, enum_func *enum_func,
> static void at_response_p(int argc, const char **argv)
> {
> bthf_at_response_t response_code;
> - int error_code = 0;
> + int error_code;
>
> RETURN_IF_NULL(if_hf);
>
> @@ -588,7 +588,9 @@ static void at_response_p(int argc, const char **argv)
> response_code = str2bthf_at_response_t(argv[2]);
>
> /* error code */
> - if (argc >= 3)
> + if (argc <= 3)
> + error_code = 0;
> + else
> error_code = atoi(argv[3]);
>
> EXEC(if_hf->at_response, response_code, error_code);
>
Applied, thanks.
--
Best regards,
Szymon Janc
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-08-29 13:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-26 13:42 [PATCH] android/client: Fix incorrect memory access Andrei Emeltchenko
2014-08-29 13:58 ` Szymon Janc
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.