Linux bluetooth development
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH obexd] Fix possible crash when using syncevolution plugin
Date: Thu,  6 Oct 2011 11:46:58 +0300	[thread overview]
Message-ID: <1317890818-15669-1-git-send-email-luiz.dentz@gmail.com> (raw)

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Context os need to be set since synce_write uses it, in addiction
check if context is valid in synce_open.
---
 plugins/syncevolution.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/plugins/syncevolution.c b/plugins/syncevolution.c
index ae13e43..a389783 100644
--- a/plugins/syncevolution.c
+++ b/plugins/syncevolution.c
@@ -230,6 +230,7 @@ static void *synce_connect(struct obex_session *os, int *err)
 	context->dbus_conn = conn;
 	context->lasterr = -EAGAIN;
 	context->id = obex_get_id(os);
+	context->os = os;
 
 	if (err)
 		*err = 0;
@@ -281,8 +282,10 @@ static void synce_disconnect(struct obex_session *os, void *user_data)
 static void *synce_open(const char *name, int oflag, mode_t mode,
 				void *user_data, size_t *size, int *err)
 {
+	struct synce_context *context = user_data;
+
 	if (err)
-		*err = 0;
+		*err = context ? 0 : -EFAULT;
 
 	return user_data;
 }
-- 
1.7.6.4


             reply	other threads:[~2011-10-06  8:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-06  8:46 Luiz Augusto von Dentz [this message]
2011-10-06  8:59 ` [PATCH obexd] Fix possible crash when using syncevolution plugin Johan Hedberg

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=1317890818-15669-1-git-send-email-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.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