From ce5c99d45c0c3e606b2b90d74eb9103c6611e26c Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Sun, 8 Nov 2015 22:12:41 -0600 Subject: [PATCH] OPENZAP-240 #resolve [GSM module uses incorrect length when parsing AT responses] Use the buffer length returned by the driver instead of trying to use strlen() --- libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c b/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c index 152ff0452e..86ea231708 100755 --- a/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c +++ b/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c @@ -1086,12 +1086,11 @@ static void *ftdm_gsm_run(ftdm_thread_t *me, void *obj) ftdm_channel_lock(gsm_data->bchan); ftdm_channel_advance_states(gsm_data->bchan); if (FTDM_SUCCESS == status && (flags & FTDM_READ)) { - int n = 0, m = 0; - + int n = 0; n = read_channel(gsm_data->dchan, buffer, sizeof(buffer) - 1); if (n > 0) { - m = strlen(buffer); /* TODO: Hum? is this needed? why not using the return val from read_channel? */ - wat_span_process_read(span->span_id, buffer, m); + wat_span_process_read(span->span_id, buffer, n); + buffer[0] = 0; } } ftdm_channel_advance_states(gsm_data->bchan);