|
From: Peter K. <pk...@us...> - 2001-03-26 16:06:47
|
The following file was modified in apps/bluetooth/sdp_server:
Name Old version New version Comment
---- ----------- ----------- -------
sdp_server.c 1.24 1.25=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Use strtoul() to extract unsigned values.
The diff of the modified file(s):
--- sdp_server.c 2001/03/26 15:52:26 1.24
+++ sdp_server.c 2001/03/26 16:06:45 1.25
@@ -291,23 +291,24 @@
position so we can fill in the length field later */=20=20=20=20=
=20=20
if (strncmp(value_string + value_string_pos, S_DES_HDR, strlen(S_DES=
_HDR)) =3D=3D 0)
{
- int j;
+ unsigned int pos;
+ unsigned int j;
=20
- i =3D (int) strtol(value_string + value_string_pos + strlen(S_DES_=
HDR),
+ pos =3D strtoul(value_string + value_string_pos + strlen(S_DES_HDR=
),
NULL, 16);
=20
/* Now we found a data element sequence header inside another
data element sequence */
- if (des_pos[i])
+ if (des_pos[pos])
{
- sprintf(c_des_len[i], "%02x", des_len[i]);
- D_MISC("c_des_len[%d]: %s", i, c_des_len[i]);
- strncpy(des_pos[i], c_des_len[i], 2);
- D_MISC("des_pos[%d]: %s", i, des_pos[i]);
+ sprintf(c_des_len[pos], "%02x", des_len[pos]);
+ D_MISC("c_des_len[%d]: %s", pos, c_des_len[pos]);
+ strncpy(des_pos[pos], c_des_len[pos], 2);
+ D_MISC("des_pos[%d]: %s", pos, des_pos[pos]);
}
- des_pos[i] =3D tmp_list + tmp_len - 2;
- des_len[i] =3D 0;
- for (j =3D i; j > 0; j--)
+ des_pos[pos] =3D tmp_list + tmp_len - 2;
+ des_len[pos] =3D 0;
+ for (j =3D pos; j > 0; j--)
{
des_len[0] +=3D (strlen(value_string + value_string_pos) - 2) / =
2;
}
@@ -420,7 +421,7 @@
if (service_class_id !=3D NULL)
{
D_RHDL("Found %s", service_class_id);
- record_handle =3D (unsigned int) strtol(service_class_id, NULL, 16);
+ record_handle =3D strtoul(service_class_id, NULL, 16);
D_RHDL("Record handle converted to int 0x%08x", record_handle);
D_MEM("<--- free%d 0x%8p", --malloc_dbg, service_class_id);
free(service_class_id);
@@ -438,7 +439,7 @@
if (attr[0] && strcmp(attr[0], "ServiceRecordHandle") =3D=3D 0)
{
S_FNC("Found Record Handle %s", attr[1]);
- s_hdl->tmp_hdl =3D (unsigned int)strtol(attr[1], NULL, 16);
+ s_hdl->tmp_hdl =3D strtoul(attr[1], NULL, 16);
S_FNC("Found Record Handle 0x%08x", s_hdl->tmp_hdl);
}
if ((s_hdl->tmp_hdl) && (strcmp(el, s_hdl->uuid) =3D=3D 0))
|