From 5b69740e1c72bd261bc37adc6fbbf09fa50cc5a2 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Tue, 21 Jul 2009 14:38:29 -0500 Subject: [PATCH] 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. --- gatchat/gatchat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gatchat/gatchat.c b/gatchat/gatchat.c index 616f843..15cc934 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 -- 2.7.4