linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Santiago Carot-Nemesio <sancane@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Santiago Carot-Nemesio <sancane@gmail.com>
Subject: [PATCH 4/6] Fix possible null pointer deference
Date: Tue, 22 Nov 2011 15:49:46 +0100	[thread overview]
Message-ID: <1321973388-16300-5-git-send-email-sancane@gmail.com> (raw)
In-Reply-To: <1321973388-16300-4-git-send-email-sancane@gmail.com>

---
 thermometer/thermometer.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/thermometer/thermometer.c b/thermometer/thermometer.c
index 9ad7e59..4faf900 100644
--- a/thermometer/thermometer.c
+++ b/thermometer/thermometer.c
@@ -599,6 +599,9 @@ static DBusMessage *write_attr_interval(struct thermometer *t, DBusMessage *msg,
 	struct characteristic *ch;
 	guint8 atval[2];
 
+	if (t->attrib == NULL)
+		return btd_error_not_connected(msg);
+
 	ch = get_characteristic(t, MEASUREMENT_INTERVAL_UUID);
 	if (ch == NULL)
 		return btd_error_not_available(msg);
@@ -672,6 +675,9 @@ static void enable_final_measurement(struct thermometer *t)
 	uint8_t atval[2];
 	gchar *msg;
 
+	if (t->attrib == NULL)
+		return;
+
 	ch = get_characteristic(t, TEMPERATURE_MEASUREMENT_UUID);
 	if (ch == NULL) {
 		DBG("Temperature measurement characteristic not found");
@@ -699,6 +705,9 @@ static void enable_intermediate_measurement(struct thermometer *t)
 	uint8_t atval[2];
 	gchar *msg;
 
+	if (t->attrib == NULL)
+		return;
+
 	ch = get_characteristic(t, INTERMEDIATE_TEMPERATURE_UUID);
 	if (ch == NULL) {
 		DBG("Intermediate measurement characteristic not found");
@@ -726,6 +735,9 @@ static void disable_final_measurement(struct thermometer *t)
 	uint8_t atval[2];
 	gchar *msg;
 
+	if (t->attrib == NULL)
+		return;
+
 	ch = get_characteristic(t, TEMPERATURE_MEASUREMENT_UUID);
 	if (ch == NULL) {
 		DBG("Temperature measurement characteristic not found");
@@ -753,6 +765,9 @@ static void disable_intermediate_measurement(struct thermometer *t)
 	uint8_t atval[2];
 	gchar *msg;
 
+	if (t->attrib == NULL)
+		return;
+
 	ch = get_characteristic(t, INTERMEDIATE_TEMPERATURE_UUID);
 	if (ch == NULL) {
 		DBG("Intermediate measurement characteristic not found");
-- 
1.7.7.4


  reply	other threads:[~2011-11-22 14:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-22 14:49 Health Thermometer Profile patches Santiago Carot-Nemesio
2011-11-22 14:49 ` [PATCH 1/6] Implement SetProperty D-Bus method Santiago Carot-Nemesio
2011-11-22 14:49   ` [PATCH 2/6] Confiure C.C.C descriptor during the thermometer configuration Santiago Carot-Nemesio
2011-11-22 14:49     ` [PATCH 3/6] Process measurements interval indication Santiago Carot-Nemesio
2011-11-22 14:49       ` Santiago Carot-Nemesio [this message]
2011-11-22 14:49         ` [PATCH 5/6] Fix access to an invalid memory sector if time stamp is not supported Santiago Carot-Nemesio
2011-11-22 14:49           ` [PATCH 6/6] Use system types instead of GLIB ones Santiago Carot-Nemesio
2011-12-02 11:26     ` [PATCH 2/6] Confiure C.C.C descriptor during the thermometer configuration Johan Hedberg
2011-12-02 11:52       ` Santiago Carot
2011-12-02 15:41         ` Anderson Lizardo
2011-12-07 14:58   ` [PATCH 1/6] Implement SetProperty D-Bus method Johan Hedberg
2011-12-09 10:02     ` Santiago Carot

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=1321973388-16300-5-git-send-email-sancane@gmail.com \
    --to=sancane@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;
as well as URLs for NNTP newsgroup(s).