* [Bluez-devel] off-by-one bugfix for sdp_data_alloc
@ 2006-09-02 17:24 Jeff Wilson
2006-09-03 21:28 ` Marcel Holtmann
0 siblings, 1 reply; 4+ messages in thread
From: Jeff Wilson @ 2006-09-02 17:24 UTC (permalink / raw)
To: bluez-devel
The following patch against bluez-libs-3.4 fixes a problem where the
last character of a null-terminated string is lost. Adding the +1
accounts for and preserves the null terminator.
Regards,
Jeff
--- bluez-libs-3.4/src/sdp.c 2006-08-24 20:16:12.000000000 -0500
+++ bluez-libs-3.4/src/sdp.c.mod 2006-09-02 12:12:51.000000000 -0500
@@ -498,7 +498,7 @@
if (!value)
return NULL;
- length = strlen((char *) value);
+ length = strlen((char *) value) + 1;
break;
default:
length = 0;
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [Bluez-devel] off-by-one bugfix for sdp_data_alloc 2006-09-02 17:24 [Bluez-devel] off-by-one bugfix for sdp_data_alloc Jeff Wilson @ 2006-09-03 21:28 ` Marcel Holtmann 2006-09-04 22:13 ` Jeff Wilson 0 siblings, 1 reply; 4+ messages in thread From: Marcel Holtmann @ 2006-09-03 21:28 UTC (permalink / raw) To: BlueZ development Hi Jeff, > The following patch against bluez-libs-3.4 fixes a problem where the > last character of a null-terminated string is lost. Adding the +1 > accounts for and preserves the null terminator. the SDP strings are not NULL terminated strings. They a prefixed with a length value. So what is the reason for storing the NULL terminator in the records? Show me an example what actually goes wrong here. Regards Marcel ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Bluez-devel mailing list Bluez-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bluez-devel ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Bluez-devel] off-by-one bugfix for sdp_data_alloc 2006-09-03 21:28 ` Marcel Holtmann @ 2006-09-04 22:13 ` Jeff Wilson 2006-09-05 9:53 ` Marcel Holtmann 0 siblings, 1 reply; 4+ messages in thread From: Jeff Wilson @ 2006-09-04 22:13 UTC (permalink / raw) To: BlueZ development Oh, I get it. I was looking at where it was published (sdp_set_info_attr), but now I see where it's queried (from `sdptool browse`). So maybe this patch is more appropriate. Regards, Jeff --- bluez-libs-3.4/src/sdp.c 2006-08-24 20:16:12.000000000 -0500 +++ bluez-libs-3.4/src/sdp.c.mod 2006-09-04 17:07:56.000000000 -0500 @@ -1148,13 +1148,13 @@ { sdp_data_t *d = sdp_data_get(rec, SDP_ATTR_SVCNAME_PRIMARY); if (d) - printf("Service Name: %s\n", d->val.str); + printf("Service Name: %.*s\n", d->unitSize, d->val.str); d = sdp_data_get(rec, SDP_ATTR_SVCDESC_PRIMARY); if (d) - printf("Service Description: %s\n", d->val.str); + printf("Service Description: %.*s\n", d->unitSize, d->val.str); d = sdp_data_get(rec, SDP_ATTR_PROVNAME_PRIMARY); if (d) - printf("Service Provider: %s\n", d->val.str); + printf("Service Provider: %.*s\n", d->unitSize, d->val.str); } #ifdef SDP_DEBUG On 9/3/06, Marcel Holtmann <marcel@holtmann.org> wrote: > Hi Jeff, > > > The following patch against bluez-libs-3.4 fixes a problem where the > > last character of a null-terminated string is lost. Adding the +1 > > accounts for and preserves the null terminator. > > the SDP strings are not NULL terminated strings. They a prefixed with a > length value. So what is the reason for storing the NULL terminator in > the records? Show me an example what actually goes wrong here. > > Regards > > Marcel > > > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Bluez-devel mailing list > Bluez-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/bluez-devel > ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Bluez-devel mailing list Bluez-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bluez-devel ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Bluez-devel] off-by-one bugfix for sdp_data_alloc 2006-09-04 22:13 ` Jeff Wilson @ 2006-09-05 9:53 ` Marcel Holtmann 0 siblings, 0 replies; 4+ messages in thread From: Marcel Holtmann @ 2006-09-05 9:53 UTC (permalink / raw) To: BlueZ development Hi Jeff, > Oh, I get it. I was looking at where it was published > (sdp_set_info_attr), but now I see where it's queried (from `sdptool > browse`). So maybe this patch is more appropriate. we can try this. Patch is in the CVS now. Regards Marcel ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Bluez-devel mailing list Bluez-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bluez-devel ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-09-05 9:53 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2006-09-02 17:24 [Bluez-devel] off-by-one bugfix for sdp_data_alloc Jeff Wilson 2006-09-03 21:28 ` Marcel Holtmann 2006-09-04 22:13 ` Jeff Wilson 2006-09-05 9:53 ` Marcel Holtmann
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox