[PATCH 1/2] android/a2dp: Fix IPC response length calculation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



struct audio_rsp_open_stream has only zero-length array member thus its
size equals to 0. We need to explicitly specify size of array element
type here.
---
 android/a2dp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/android/a2dp.c b/android/a2dp.c
index 9f3164a..145cd67 100644
--- a/android/a2dp.c
+++ b/android/a2dp.c
@@ -1088,8 +1088,8 @@ static void bt_stream_open(const void *buf, uint16_t len)
 		return;
 	}
 
-	len = sizeof(*rsp) + setup->preset->len;
-	rsp = g_malloc0(sizeof(*rsp) + setup->preset->len);
+	len = sizeof(struct audio_preset) + setup->preset->len;
+	rsp = g_malloc0(len);
 	rsp->preset->len = setup->preset->len;
 	memcpy(rsp->preset->data, setup->preset->data, setup->preset->len);
 
-- 
1.8.5.2

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux