Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ v2] Fix incorrect use of atoi in maemo6
@ 2011-10-28 11:41 Dmitriy Paliy
  2011-10-28 11:47 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitriy Paliy @ 2011-10-28 11:41 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Dmitriy Paliy

Use of atoi is incorrect and unsafe in maemo6 telephony and replaced
by g_ascii_digit_value.
---
 audio/telephony-maemo6.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/audio/telephony-maemo6.c b/audio/telephony-maemo6.c
index 5df3235..10967fb 100644
--- a/audio/telephony-maemo6.c
+++ b/audio/telephony-maemo6.c
@@ -823,7 +823,10 @@ static int tonegen_startevent(char tone)
 		event_tone = DTMF_D;
 		break;
 	default:
-		event_tone = atoi(&tone);
+		ret = g_ascii_digit_value(tone);
+		if (ret < 0)
+			return -EINVAL;
+		event_tone = ret;
 	}
 
 	ret = send_method_call(TONEGEN_BUS_NAME, TONEGEN_PATH,
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH BlueZ v2] Fix incorrect use of atoi in maemo6
  2011-10-28 11:41 [PATCH BlueZ v2] Fix incorrect use of atoi in maemo6 Dmitriy Paliy
@ 2011-10-28 11:47 ` Johan Hedberg
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2011-10-28 11:47 UTC (permalink / raw)
  To: Dmitriy Paliy; +Cc: linux-bluetooth

Hi Dmitriy,

On Fri, Oct 28, 2011, Dmitriy Paliy wrote:
> Use of atoi is incorrect and unsafe in maemo6 telephony and replaced
> by g_ascii_digit_value.
> ---
>  audio/telephony-maemo6.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)

Applied. Thanks.

Johan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-10-28 11:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-28 11:41 [PATCH BlueZ v2] Fix incorrect use of atoi in maemo6 Dmitriy Paliy
2011-10-28 11:47 ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox