summaryrefslogtreecommitdiffstats
path: root/gatchat/gatchat.c
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2009-07-21 14:38:29 -0500
committerDenis Kenzior <denkenz@gmail.com>2009-07-21 14:43:33 -0500
commitd4536b3d2b8a1b4fbfd748f114de8331f6e9e757 (patch)
treebad09308961ad1b2310c3e28ed57b23a794cbed3 /gatchat/gatchat.c
parentb638b315f941c1d196b7f3967e2220c87efbccc7 (diff)
downloadofono-d4536b3d2b8a1b4fbfd748f114de8331f6e9e757.tar.bz2
Fix a crash with unsolicited notifications
When a line comes in from the modem, we check against prefixes in outstanding commands and unsolicited notifications. If the outstanding command has not yet been sent (cmd_bytes_written == 0), we still check it resulting in access violation.
Diffstat (limited to 'gatchat/gatchat.c')
-rw-r--r--gatchat/gatchat.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gatchat/gatchat.c b/gatchat/gatchat.c
index 616f843a..15cc934c 100644
--- a/gatchat/gatchat.c
+++ b/gatchat/gatchat.c
@@ -466,7 +466,7 @@ static void have_line(GAtChat *p, gboolean strip_preceding)
cmd = g_queue_peek_head(p->command_queue);
- if (cmd) {
+ if (cmd && p->cmd_bytes_written > 0) {
char c = cmd->cmd[p->cmd_bytes_written - 1];
/* We check that we have submitted a terminator, in which case