Linux bluetooth development
 help / color / mirror / Atom feed
From: Dmitriy Paliy <dmitriy.paliy@nokia.com>
To: linux-bluetooth@vger.kernel.org
Cc: Dmitriy Paliy <dmitriy.paliy@nokia.com>
Subject: [PATCH BlueZ] Fix incorrect use of atoi in maemo6
Date: Thu, 27 Oct 2011 13:42:56 +0300	[thread overview]
Message-ID: <1319712176-709-1-git-send-email-dmitriy.paliy@nokia.com> (raw)

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

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


             reply	other threads:[~2011-10-27 10:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-27 10:42 Dmitriy Paliy [this message]
2011-10-27 13:22 ` [PATCH BlueZ] Fix incorrect use of atoi in maemo6 Anderson Lizardo
2011-10-27 13:33   ` Dmitriy Paliy
2011-10-28 11:00 ` 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=1319712176-709-1-git-send-email-dmitriy.paliy@nokia.com \
    --to=dmitriy.paliy@nokia.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox