Skip to contentSkip to conversation

possible minor bug in l2cap.c

Bluez-devel Martin Röhricht 1 participant 2 messages Jan 12, 2006 – Jan 27, 2006 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

Hello together,

I was wondering if there is an uninitialised variable in use:
In function l2cap_config_req() we declare =C2=BBu8 rsp[64];=C2=AB and call = it only
twice:

	l2cap_send_cmd(conn, cmd->ident, L2CAP_CONF_RSP,
		l2cap_build_conf_rsp(sk, rsp, NULL), rsp);
	l2cap_send_cmd(conn, cmd->ident, L2CAP_CONF_RSP,
		l2cap_build_conf_rsp(sk, rsp, &result), rsp);

In l2cap_build_conf_rsp() (rsp changed its name to data) we access it like that:

	struct l2cap_conf_rsp *rsp =3D data;
        void *ptr =3D rsp->data;

I think whatever is going to be in ptr is from now on undefined, right? But maybe I'm just wrong and someone could help me out?!

Martin

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#1 lore raw

Am Donnerstag, den 12.01.2006, 17:16 +0100 schrieb Martin R=C3=B6hricht:

Quoted 4 lines

Hello together,
=20
I was wondering if there is an uninitialised variable in use:
In function l2cap_config_req() we declare =C2=BBu8 rsp[64];=C2=AB and cal=

l it only

Quoted 10 lines

twice:

	l2cap_send_cmd(conn, cmd->ident, L2CAP_CONF_RSP,
		l2cap_build_conf_rsp(sk, rsp, NULL), rsp);
	l2cap_send_cmd(conn, cmd->ident, L2CAP_CONF_RSP,
		l2cap_build_conf_rsp(sk, rsp, &result), rsp);
=20
In l2cap_build_conf_rsp() (rsp changed its name to data) we access it
like that:
	struct l2cap_conf_rsp *rsp =3D data;
        void *ptr =3D rsp->data;
Quoted 3 lines

=20
I think whatever is going to be in ptr is from now on undefined, right? But maybe I'm just wrong and someone could help me out?!

I was wrong -- ptr is set some lines later. Everything should be fine with it so far.

Martin

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel