[PATCH BlueZ 2/3] eir: Fix incorrect eir_length() parsing

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

 



Issue:
The COD value displayed via dbus during inquiry is wrong.
This is because of the incorrect return length of the eir_length(),
which leads to appending the COD at wrong location.

Analysis:
After appending the COD at the end of the eir data, we can see
there are some '00' present in the eir field length in the eir file.
XX:XX:XX:XX:XX:XX 07095359414D5043020A040B0312111F110C110E110311
0000000000000000000000040D000142

Fix:
Corrected the length calculation in eir_length(), which is determining,
which position the COD should append
---
 src/eir.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/eir.c b/src/eir.c
index 7b7b705..d622b08 100644
--- a/src/eir.c
+++ b/src/eir.c
@@ -379,9 +379,9 @@ size_t eir_append_data(uint8_t *eir, size_t eir_len, uint8_t type,
 size_t eir_length(uint8_t *eir, size_t maxlen)
 {
 	uint8_t field_len;
-	size_t parsed, length;
+	size_t parsed = 0, length = 0;
 
-	for (parsed = 0, length = 0; parsed < maxlen - 1; parsed += field_len) {
+	while (parsed < maxlen - 1) {
 		field_len = eir[0];
 
 		if (field_len == 0)
-- 
1.7.4.1

--
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