Open Source Telephony
 help / color / mirror / Atom feed
From: Andrzej Zaborowski <andrew.zaborowski@intel.com>
To: ofono@ofono.org
Subject: [PATCH] stk: reorder: Don't access freed memory in Send SMS
Date: Fri, 20 Aug 2010 04:07:09 +0200	[thread overview]
Message-ID: <1282270029-2909-1-git-send-email-andrew.zaborowski@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 939 bytes --]

Responding to the stk->pending_cmd frees it, we need to read it
before that.
---
 src/stk.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/stk.c b/src/stk.c
index ce71075..f391396 100644
--- a/src/stk.c
+++ b/src/stk.c
@@ -695,6 +695,10 @@ static void send_sms_submit_cb(gboolean ok, void *data)
 		return;
 	}
 
+	if (stk->pending_cmd->send_sms.alpha_id &&
+			stk->pending_cmd->send_sms.alpha_id[0])
+		stk_alpha_id_unset(stk);
+
 	memset(&rsp, 0, sizeof(rsp));
 
 	if (ok == FALSE)
@@ -702,10 +706,6 @@ static void send_sms_submit_cb(gboolean ok, void *data)
 
 	if (stk_respond(stk, &rsp, stk_command_cb))
 		stk_command_cb(&failure, stk);
-
-	if (stk->pending_cmd->send_sms.alpha_id &&
-			stk->pending_cmd->send_sms.alpha_id[0])
-		stk_alpha_id_unset(stk);
 }
 
 static gboolean handle_command_send_sms(const struct stk_command *cmd,
-- 
1.7.1.86.g0e460.dirty


             reply	other threads:[~2010-08-20  2:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-20  2:07 Andrzej Zaborowski [this message]
2010-08-20 14:04 ` [PATCH] stk: reorder: Don't access freed memory in Send SMS Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1282270029-2909-1-git-send-email-andrew.zaborowski@intel.com \
    --to=andrew.zaborowski@intel.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox