Skip to contentSkip to conversation

marshalling SDP_URL_STR

Bluez-devel Stephen Crane 2 participants 2 messages Jan 23, 2007 – Jan 31, 2007 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

Hello again,
It looks as if these types aren't being marshalled properly in the SDP library. (They should be treated identically to SDP_TEXT_STR.)

The current code causes 1 byte too many to be allocated to them in the marshalled form which results in garbage when it is read out of the buffer.

The attached patch treats them the same as SDP_TEXT_STR, aside from the DTD of course.

Cheers,
Steve

Index: sdp.c
===================================================================
RCS file: /cvsroot/bluez/libs/src/sdp.c,v
retrieving revision 1.70

sdp.c +1 -5
diff -u -r1.70 sdp.c
@@ -741,15 +741,11 @@
 	case SDP_TEXT_STR8:
 	case SDP_TEXT_STR16:
 	case SDP_TEXT_STR32:
-		src = (unsigned char *)d->val.str;
-		data_size = d->unitSize - sizeof(uint8_t);
-		sdp_set_seq_len(seqp, data_size);
-		break;
 	case SDP_URL_STR8:
 	case SDP_URL_STR16:
 	case SDP_URL_STR32:
 		src = (unsigned char *)d->val.str;
-		data_size = strlen(d->val.str);
+		data_size = d->unitSize - sizeof(uint8_t);
 		sdp_set_seq_len(seqp, data_size);
 		break;
 	case SDP_SEQ8:

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#1 lore raw

Hi Steve,

Quoted 9 lines

It looks as if these types aren't being marshalled properly in the SDP library. (They should be treated identically to SDP_TEXT_STR.)

The current code causes 1 byte too many to be allocated to them in the marshalled form which results in garbage when it is read out of the buffer.

The attached patch treats them the same as SDP_TEXT_STR, aside from the DTD of course.

are you sure that this doesn't break anything?

Regards

Marcel

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel