* [PATCH v2] Fix blutoothd exit on badly formated AT+VTS
@ 2011-02-09 14:55 Dmitriy Paliy
2011-02-09 22:01 ` Johan Hedberg
0 siblings, 1 reply; 2+ messages in thread
From: Dmitriy Paliy @ 2011-02-09 14:55 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Dmitriy Paliy
This fixes bluetoothd exit when AT+VTS command is badly formatted,
e.g. as AT+VTS\xfe\xfe[...]=1
Verification it done for the numeric value to be larger than 0x23,
that corresponds to the hash '#', and to be lower than 0x44, that
corresponds to 'D', such that the tone is in {0-9, *, #, A, B, C, D}.
---
audio/headset.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/audio/headset.c b/audio/headset.c
index 0270e2c..bdaa8da 100644
--- a/audio/headset.c
+++ b/audio/headset.c
@@ -1015,12 +1015,18 @@ int telephony_transmit_dtmf_rsp(void *telephony_device, cme_error_t err)
static int dtmf_tone(struct audio_device *device, const char *buf)
{
+ char tone;
+
if (strlen(buf) < 8) {
error("Too short string for DTMF tone");
return -EINVAL;
}
- telephony_transmit_dtmf_req(device, buf[7]);
+ tone = buf[7];
+ if (tone >= '#' && tone <= 'D')
+ telephony_transmit_dtmf_req(device, tone);
+ else
+ return -EINVAL;
return 0;
}
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] Fix blutoothd exit on badly formated AT+VTS
2011-02-09 14:55 [PATCH v2] Fix blutoothd exit on badly formated AT+VTS Dmitriy Paliy
@ 2011-02-09 22:01 ` Johan Hedberg
0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2011-02-09 22:01 UTC (permalink / raw)
To: Dmitriy Paliy; +Cc: linux-bluetooth
Hi Dmitriy,
On Wed, Feb 09, 2011, Dmitriy Paliy wrote:
> This fixes bluetoothd exit when AT+VTS command is badly formatted,
> e.g. as AT+VTS\xfe\xfe[...]=1
>
> Verification it done for the numeric value to be larger than 0x23,
> that corresponds to the hash '#', and to be lower than 0x44, that
> corresponds to 'D', such that the tone is in {0-9, *, #, A, B, C, D}.
> ---
> audio/headset.c | 8 +++++++-
> 1 files changed, 7 insertions(+), 1 deletions(-)
Pushed upstream (after the obvious typo fix in the subject). Thanks.
Johan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-02-09 22:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-09 14:55 [PATCH v2] Fix blutoothd exit on badly formated AT+VTS Dmitriy Paliy
2011-02-09 22:01 ` Johan Hedberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).