summaryrefslogtreecommitdiff
path: root/gatchat
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2009-07-21 14:38:29 -0500
committerMarcel Holtmann <marcel@holtmann.org>2009-07-21 21:45:01 +0200
commit5b69740e1c72bd261bc37adc6fbbf09fa50cc5a2 (patch)
treecfe51aca3542c1752e3ce68000e9e916a923f223 /gatchat
parent7c73daec2f89ccd829881c608e833e5dc859bbcb (diff)
downloadconnman-5b69740e1c72bd261bc37adc6fbbf09fa50cc5a2.tar.gz
connman-5b69740e1c72bd261bc37adc6fbbf09fa50cc5a2.tar.bz2
connman-5b69740e1c72bd261bc37adc6fbbf09fa50cc5a2.zip
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')
-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