Thread (4 messages) flat view 4 messages, 4 authors, 2011-10-28
STALE5408d

[PATCH BlueZ] Fix incorrect use of atoi in maemo6

From: Dmitriy Paliy <hidden>
Date: 2011-10-27 10:42:56
Subsystem: the rest · Maintainer: Linus Torvalds

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help