All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Eggers <ceggers@arri.de>
To: <linux-bluetooth@vger.kernel.org>
Cc: Christian Eggers <ceggers@arri.de>
Subject: [PATCH BlueZ 8/9] gatt: proxy_property_changed: check for NULL iterator
Date: Fri, 23 Sep 2022 12:27:12 +0200	[thread overview]
Message-ID: <20220923102712.10604-1-ceggers@arri.de> (raw)
In-Reply-To: <20220923102421.10336-1-ceggers@arri.de>

The passed iterator can be NULL as in
src/gatt-database.c::properties_changed():
...
   proxy->prop_func(..., ..., iter=NULL, ...)
   +--client/gatt.c::property_changed_cb(..., ..., iter, ...);
      +--dbus_message_iter_get_arg_type(iter);
...
---
 src/gatt-database.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/gatt-database.c b/src/gatt-database.c
index c72f4a4d5c54..ea282d4bc193 100644
--- a/src/gatt-database.c
+++ b/src/gatt-database.c
@@ -2867,17 +2867,19 @@ static void property_changed_cb(GDBusProxy *proxy, const char *name,
 	if (strcmp(name, "Value"))
 		return;
 
-	if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_ARRAY) {
-		DBG("Malformed \"Value\" property received");
-		return;
-	}
+	if (iter) {
+		if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_ARRAY) {
+			DBG("Malformed \"Value\" property received");
+			return;
+		}
 
-	dbus_message_iter_recurse(iter, &array);
-	dbus_message_iter_get_fixed_array(&array, &value, &len);
+		dbus_message_iter_recurse(iter, &array);
+		dbus_message_iter_get_fixed_array(&array, &value, &len);
 
-	if (len < 0) {
-		DBG("Malformed \"Value\" property received");
-		return;
+		if (len < 0) {
+			DBG("Malformed \"Value\" property received");
+			return;
+		}
 	}
 
 	/* Truncate the value if it's too large */
-- 
2.35.3


  parent reply	other threads:[~2022-09-23 10:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-23 10:24 [PATCH BlueZ 0/9] properties_changed: check for NULL iterator Christian Eggers
2022-09-23 10:24 ` [PATCH BlueZ 1/9] advertising: parse_secondary: fix loop condition Christian Eggers
2022-09-23 11:21   ` properties_changed: check for NULL iterator bluez.test.bot
2022-09-23 10:24 ` [PATCH BlueZ 2/9] advertising: parse_secondary: fix mask value Christian Eggers
2022-09-23 10:24 ` [PATCH BlueZ 3/9] advertising: parse_secondary: check for NULL iterator Christian Eggers
2022-09-23 10:24 ` [PATCH BlueZ 4/9] advertising: parse_min_interval: reset min_interval if iter is NULL Christian Eggers
2022-09-23 10:26 ` Christian Eggers
2022-09-23 20:50   ` patchwork-bot+bluetooth
2022-09-23 10:26 ` [PATCH BlueZ 5/9] advertising: parse_[min|max]_interval: reset value " Christian Eggers
2022-09-23 10:26 ` [PATCH BlueZ 6/9] advertising: parse_tx_power: " Christian Eggers
2022-09-23 10:26 ` [PATCH BlueZ 7/9] client/gatt: proxy_property_changed: check for NULL iterator Christian Eggers
2022-09-23 10:27 ` Christian Eggers [this message]
2022-09-23 10:27 ` [PATCH BlueZ 9/9] battery: provided_battery_property_changed_cb: " Christian Eggers

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=20220923102712.10604-1-ceggers@arri.de \
    --to=ceggers@arri.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.