summaryrefslogtreecommitdiff
path: root/gatchat
diff options
context:
space:
mode:
authorKuba Pawlak <kubax.t.pawlak@intel.com>2016-11-10 10:22:44 +0100
committerDenis Kenzior <denkenz@gmail.com>2016-11-10 10:18:26 -0600
commit5a6fe84ec01a6e7097a89f0f69f19562bdc25d2b (patch)
tree9c7b0d2c6fe246b120eabc2909c20038de2ff12b /gatchat
parentf750366261962118917a6f5e9c1d6f69871fe68a (diff)
downloadofono-5a6fe84ec01a6e7097a89f0f69f19562bdc25d2b.tar.gz
gatchat: Fix parsing fields with odd number of quotation marks
Events like +CLCC and +CCWA can have contact name attached to the end of line. If this field contains odd number of quotation marks, parser will eventually reject such message as malformatted.
Diffstat (limited to 'gatchat')
-rw-r--r--gatchat/gatsyntax.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gatchat/gatsyntax.c b/gatchat/gatsyntax.c
index 800e35f0..4d01ed7f 100644
--- a/gatchat/gatsyntax.c
+++ b/gatchat/gatsyntax.c
@@ -309,6 +309,12 @@ static GAtSyntaxResult gsm_permissive_feed(GAtSyntax *syntax,
case GSM_PERMISSIVE_STATE_RESPONSE_STRING:
if (byte == '"')
syntax->state = GSM_PERMISSIVE_STATE_RESPONSE;
+ else if (byte == '\r') {
+ syntax->state = GSM_PERMISSIVE_STATE_IDLE;
+ i += 1;
+ res = G_AT_SYNTAX_RESULT_LINE;
+ goto out;
+ }
break;
case GSM_PERMISSIVE_STATE_GUESS_PDU: