From: Helen Clemson <[email protected]>
Strlen includes a NULL character. This change affects both stemodem and
hfpmodem.
---
drivers/hfpmodem/voicecall.c | 4 ++--
drivers/stemodem/voicecall.c | 5 ++---
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/hfpmodem/voicecall.c b/drivers/hfpmodem/voicecall.c
index 4c8ee37..1aefc53 100644
--- a/drivers/hfpmodem/voicecall.c
+++ b/drivers/hfpmodem/voicecall.c
@@ -590,8 +590,8 @@ static void hfp_send_dtmf(struct ofono_voicecall *vc, const
char *dtmf,
req->data = data;
req->affected_types = 0;
- /* strlen("AT+VTS=") = 7 */
- buf = g_try_new(char, strlen(dtmf) + 7);
+ /* strlen("AT+VTS=) = 7 + NULL */
+ buf = g_try_new(char, strlen(dtmf) + 8);
if (buf == NULL)
goto error;
diff --git a/drivers/stemodem/voicecall.c b/drivers/stemodem/voicecall.c
index 8f3533d..ea3d48f 100644
--- a/drivers/stemodem/voicecall.c
+++ b/drivers/stemodem/voicecall.c
@@ -375,15 +375,14 @@ static void ste_send_dtmf(struct ofono_voicecall *vc,
const char *dtmf,
{
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
struct cb_data *cbd = cb_data_new(cb, data);
- int len = strlen(dtmf);
int s;
char *buf;
if (cbd == NULL)
goto error;
- /* strlen("AT+VTS=) = 7 */
- buf = g_try_new(char, len + 7);
+ /* strlen("AT+VTS=) = 7 + NULL */
+ buf = g_try_new(char, strlen(dtmf) + 8);
if (buf == NULL)
goto error;
--
1.7.1
_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono