From: Denis Kenzior Date: Tue, 21 Jul 2009 19:38:29 +0000 (-0500) Subject: Fix a crash with unsolicited notifications X-Git-Tag: 2.0_alpha~3419 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5b69740e1c72bd261bc37adc6fbbf09fa50cc5a2;p=framework%2Fconnectivity%2Fconnman.git 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. --- 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