bluez/0003-input-Fix-crash-when-SDP-record-isn-t-available.patch
2013-12-10 09:25:13 +01:00

30 lines
936 B
Diff

From 1da26fd3ce47728f423e290e3928257ead9baf76 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Sat, 7 Dec 2013 15:51:47 +0100
Subject: [PATCH] input: Fix crash when SDP record isn't available
On startup, if the SDP cache has been removed but the pairing
information is still present, we'd crash trying to access inside a
NULL record struct.
---
profiles/input/device.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/profiles/input/device.c b/profiles/input/device.c
index 6523161..8a28b0d 100644
--- a/profiles/input/device.c
+++ b/profiles/input/device.c
@@ -811,6 +811,9 @@ static struct input_device *input_device_new(struct btd_service *service)
struct input_device *idev;
char name[HCI_MAX_NAME_LENGTH + 1];
+ if (!rec)
+ return NULL;
+
idev = g_new0(struct input_device, 1);
bacpy(&idev->src, adapter_get_address(adapter));
bacpy(&idev->dst, device_get_address(device));
--
1.8.4.2