linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ 1/3] Fix wrong offset in EIR name parsing
@ 2012-01-17 16:18 Anderson Lizardo
  2012-01-17 16:18 ` [PATCH BlueZ 2/3] Fix g_strndup() call for EIR name Anderson Lizardo
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Anderson Lizardo @ 2012-01-17 16:18 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo

When looking for NUL byte terminators on EIR names, the first two bytes
of the EIR field should be skipped, which correspond to field length and
EIR type.
---
 src/eir.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/eir.c b/src/eir.c
index 1b68949..ff50cf8 100644
--- a/src/eir.c
+++ b/src/eir.c
@@ -159,7 +159,8 @@ int eir_parse(struct eir_data *eir, uint8_t *eir_data, uint8_t eir_len)
 			 * the name */
 			name_len = field_len - 1;
 
-			while (name_len > 0 && eir_data[name_len - 1] == '\0')
+			while (name_len > 0 &&
+					eir_data[2 + name_len - 1] == '\0')
 				name_len--;
 
 			if (!g_utf8_validate((char *) &eir_data[2],
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-01-17 19:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-17 16:18 [PATCH BlueZ 1/3] Fix wrong offset in EIR name parsing Anderson Lizardo
2012-01-17 16:18 ` [PATCH BlueZ 2/3] Fix g_strndup() call for EIR name Anderson Lizardo
2012-01-17 16:18 ` [PATCH BlueZ 3/3] Fix not showing name if first EIR has no name info Anderson Lizardo
2012-01-17 19:43   ` Johan Hedberg
2012-01-17 19:58     ` Anderson Lizardo
2012-01-17 19:35 ` [PATCH BlueZ 1/3] Fix wrong offset in EIR name parsing Johan Hedberg

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