From: Peter K. <pk...@us...> - 2001-03-25 09:50:04
|
The following file was modified in apps/bluetooth/sdp_server: Name Old version New version Comment ---- ----------- ----------- ------- sdp_server.c 1.17 1.18=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Use the defines for the error messages. The diff of the modified file(s): --- sdp_server.c 2001/02/27 15:32:14 1.17 +++ sdp_server.c 2001/03/25 09:50:02 1.18 @@ -715,7 +715,7 @@ { fprintf(stderr, FNC"Didn't find service class name for RecordHandle 0x= %08x\n", record_handle); =20 - set_err(2); + set_err(SDP_INVALID_SERVICE_RECORD_HANDLE); D_MEM("<--- free%d 0x%08x\n",malloc_dbg--, (int) search_struct.attribu= te_name); free(search_struct.attribute_name); return NULL; @@ -1340,8 +1340,8 @@ } else { - int err; - err =3D get_err(); + int err =3D get_err(); + if (err) { send_error_rsp(db_hdl->db.sdp_con_id, db_hdl->db.trans_id, err); @@ -1594,7 +1594,7 @@ int send_len; =20=20=20 if (!cont_state_buf) { - send_error_rsp(sdp_con_id, trans_id, 5); + send_error_rsp(sdp_con_id, trans_id, SDP_INVALID_CONTINUATION_STATE); } else { @@ -1638,7 +1638,7 @@ =20 /* FIXME: Have to implement this too... */ =20 - send_error_rsp(sdp_con_id, trans_id, 1); + send_error_rsp(sdp_con_id, trans_id, SDP_INVALID_SDP_VERSION); } } } @@ -1651,7 +1651,7 @@ int send_len; =20=20=20 if (!cont_state_buf) { - send_error_rsp(sdp_con_id, trans_id, 5); + send_error_rsp(sdp_con_id, trans_id, SDP_INVALID_CONTINUATION_STATE); } else { @@ -1691,7 +1691,7 @@ =20 /* FIXME: Have to implement this too... */ =20 - send_error_rsp(sdp_con_id, trans_id, 1); + send_error_rsp(sdp_con_id, trans_id, SDP_INVALID_SDP_VERSION); } } } |
From: Peter K. <pk...@us...> - 2001-03-26 12:58:27
|
The following file was modified in apps/bluetooth/sdp_server: Name Old version New version Comment ---- ----------- ----------- ------- sdp_server.c 1.20 1.21=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Removed unnecessary casts when calling malloc(). The diff of the modified file(s): --- sdp_server.c 2001/03/26 12:25:24 1.20 +++ sdp_server.c 2001/03/26 12:58:25 1.21 @@ -252,7 +252,7 @@ unsigned char *hex_data; =20 m_size =3D strlen(char_data) / 2;=20 - hex_data =3D (char*) malloc(m_size); + hex_data =3D malloc(m_size); D_MEM("---> malloc%d %ld bytes at 0x%8p", malloc_dbg++, m_size, hex_data= ); =20 /* FIXME, How will this work when using big endian ? */ @@ -288,7 +288,7 @@ des_pos[i] =3D NULL; } =20=20=20 - tmp_list =3D (char*) malloc(256); + tmp_list =3D malloc(256); D_MEM("---> malloc%d %d bytes at 0x%8p", malloc_dbg++, 256, tmp_list); =20 /* While we have not reached the end of the string */ @@ -475,7 +475,7 @@ { tmp =3D s_hdl->hdl_list; s_hdl->block_len =3D s_hdl->hdl_list_len + s_hdl->block_len * 2; - s_hdl->hdl_list =3D (unsigned int*) malloc(s_hdl->block_len); + s_hdl->hdl_list =3D malloc(s_hdl->block_len); D_MEM("---> malloc%d %d bytes at 0x%8p", malloc_dbg++, s_hdl->bloc= k_len, s_hdl->hdl_list); =20 memcpy(s_hdl->hdl_list, tmp, s_hdl->hdl_list_len); @@ -528,7 +528,7 @@ =20 s_hdl.hdl_list_len =3D 0; s_hdl.block_len =3D 16 * sizeof(unsigned int); - s_hdl.hdl_list =3D (unsigned int*) malloc(s_hdl.block_len); + s_hdl.hdl_list =3D malloc(s_hdl.block_len); =20=20=20 p =3D XML_ParserCreate(NULL); XML_SetElementHandler(p, get_more_rec_hdl_start, get_more_rec_hdl_end); @@ -544,7 +544,7 @@ tmp_len =3D s_hdl.hdl_list_len + sizeof(unsigned int); s_hdl.block_len +=3D 1; =20=20=20=20=20 - s_hdl.hdl_list =3D (unsigned int*) malloc(tmp_len); + s_hdl.hdl_list =3D malloc(tmp_len); D_MEM("---> malloc%d %d bytes at 0x%8p", malloc_dbg++, tmp_len, s_hdl.= hdl_list); =20=20=20=20=20 memcpy(s_hdl.hdl_list, tmp, s_hdl.hdl_list_len); @@ -569,7 +569,7 @@ char *return_sequence; =20 /* FIXME: But for now 256 bytes will do */ - return_sequence =3D (char*) malloc(256); + return_sequence =3D malloc(256); D_MEM("---> malloc%d %d bytes at 0x%8p", malloc_dbg++, 256, return_seque= nce); =20=20=20 =20=20=20 @@ -709,7 +709,7 @@ =20 hex_tmp =3D char2hex(char_tmp); =20 - return_sequence =3D (char*) malloc(len + 2); + return_sequence =3D malloc(len + 2); D_MEM("---> malloc%d %d bytes at 0x%8p", malloc_dbg++, len + 2, return_s= equence); =20=20=20 return_sequence[0] =3D 0x35; @@ -1003,7 +1003,7 @@ { S_FNC("Found %s", attr[i]); m_size =3D strlen(attr[i] + 1); - search_hdl->search_attr =3D (char*) malloc(m_size); + search_hdl->search_attr =3D malloc(m_size); D_MEM("---> malloc%d % d bytes at 0x%8p", malloc_dbg++, m_size, = search_hdl->search_attr); strcpy(search_hdl->search_attr, attr[i]); return; @@ -1022,7 +1022,7 @@ { S_FNC("Found %s", attr[i + 1]); m_size =3D strlen(attr[i + 1] + 1); - search_hdl->search_val =3D (char*) malloc(m_size); + search_hdl->search_val =3D malloc(m_size); D_MEM("---> malloc%d %d bytes at 0x%8p", malloc_dbg++, m_size, s= earch_hdl->search_val); strcpy(search_hdl->search_val, attr[i + 1]); return; @@ -1038,7 +1038,7 @@ (strcmp(search_hdl->search_val, attr[i + 1]) =3D=3D 0)) { m_size =3D strlen(el) + 1; - search_hdl->search_name =3D (char*) malloc(m_size); + search_hdl->search_name =3D malloc(m_size); D_MEM("---> malloc%d %d bytes at 0x%8p", malloc_dbg++, m_size, sea= rch_hdl->search_name); strcpy(search_hdl->search_name, el); return; @@ -1115,7 +1115,7 @@ /* Allocate space for all the attribute UUIDs plus the attribute count in the search_output pointer, */ m_size =3D attr_cnt * 4 + 4; - search_hdl->search_val =3D (char*) malloc(m_size); + search_hdl->search_val =3D malloc(m_size); D_MEM("---> malloc%d %d bytes at 0x%8p", malloc_dbg++, m_size, search_= hdl->search_val); memcpy(search_hdl->search_val, &attr_cnt, 4); for (i =3D 0; attr[i]; i +=3D 2) @@ -1441,7 +1441,7 @@ bytes */ len -=3D cnt_len; =20=20=20=20=20 - cont_state_buf =3D (cont_state_struct*) malloc(sizeof(cont_state_struc= t) + cnt_len); + cont_state_buf =3D malloc(sizeof(cont_state_struct) + cnt_len); D_MEM("---> malloc%d %ld bytes at 0x%8p", malloc_dbg++, sizeof(cont_st= ate_struct) + cnt_len, cont_state_buf); =20 cont_state_buf->pdu =3D pkt[0]; @@ -1495,7 +1495,7 @@ bytes */ len -=3D cont_len; =20=20=20=20 - cont_state_buf =3D (cont_state_struct*) malloc(sizeof(cont_state_struc= t) + cont_len); + cont_state_buf =3D malloc(sizeof(cont_state_struct) + cont_len); D_MEM("---> malloc%d %ld bytes at 0x%8p", malloc_dbg++, sizeof(cont_st= ate_struct) + cont_len , cont_state_buf); =20 cont_state_buf->pdu =3D pkt[0]; @@ -1546,7 +1546,7 @@ the attributes and the continuation state field */ send_len =3D SDP_HDR_SIZE + 2 + 2 + cont_state_buf->len + 1; =20 - send_buf =3D (unsigned char*) malloc(send_len); + send_buf =3D malloc(send_len); D_MEM("---> malloc%d %d bytes at 0x%8p", malloc_dbg++, send_len, sen= d_buf); =20 set_sdp_hdr(send_buf, cont_state_buf->pdu, trans_id, send_len - SDP_= HDR_SIZE); @@ -1602,7 +1602,7 @@ the attributes and the continuation state field */ send_len =3D SDP_HDR_SIZE + 2 + cont_state_buf->len + 1; =20 - send_buf =3D (unsigned char*) malloc(send_len); + send_buf =3D malloc(send_len); D_MEM("---> malloc%d %d bytes at 0x%8p", malloc_dbg++, send_len, sen= d_buf); =20 set_sdp_hdr(send_buf, cont_state_buf->pdu, trans_id, send_len - SDP_= HDR_SIZE); |
From: Peter K. <pk...@us...> - 2001-03-26 14:02:11
|
The following file was modified in apps/bluetooth/sdp_server: Name Old version New version Comment ---- ----------- ----------- ------- sdp_server.c 1.22 1.23=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * char2hex() now takes the result buffer as argument. * get_values() uses a static buffer for its result. * Removed two unnecessary malloc()'s and a memcpy() due to the two changes above.=20 The diff of the modified file(s): --- sdp_server.c 2001/03/26 13:48:28 1.22 +++ sdp_server.c 2001/03/26 14:02:09 1.23 @@ -119,7 +119,7 @@ #endif =20 void start_xml_parser(XML_Parser p, int fd); -unsigned char* char2hex(char *char_data); +void char2hex(const char *char_data, unsigned char* buf); char* get_values(char *value_string, int value_string_len, int fd); void set_sdp_hdr(unsigned char *hdr, unsigned char pkt_type, unsigned short trans_id, unsigned short len); @@ -241,32 +241,25 @@ } while (len); } =20 -unsigned char* -char2hex(char *char_data) +void +char2hex(const char *char_data, unsigned char* buf) { - int i =3D 0, m_size; + int i; int tmp; - unsigned char *hex_data; - - m_size =3D strlen(char_data) / 2;=20 - hex_data =3D malloc(m_size); - D_MEM("---> malloc%d %ld bytes at 0x%8p", malloc_dbg++, m_size, hex_data= ); =20 /* FIXME, How will this work when using big endian ? */ for (i =3D 0; i < strlen(char_data) / 2; i++) { sscanf(char_data + i * 2, "%02x", &tmp); - hex_data[i] =3D (unsigned char)(tmp & 0xff); + buf[i] =3D (unsigned char)(tmp & 0xff); } -=20=20 - return hex_data; } =20 char* get_values(char *value_string, int value_string_len, int fd) { int value_string_pos =3D 0; - char *tmp_list; + static char tmp_list[256]; char tmp_len =3D 0; char *des_pos[DES_HDR_DEPTH]; /* des stands for Data Elemet Sequence */ int des_len[DES_HDR_DEPTH]; @@ -285,9 +278,6 @@ des_pos[i] =3D NULL; } =20=20=20 - tmp_list =3D malloc(256); - D_MEM("---> malloc%d %d bytes at 0x%8p", malloc_dbg++, 256, tmp_list); - /* While we have not reached the end of the string */ while (value_string_pos < value_string_len) { @@ -647,7 +637,6 @@ XML_Parser p; char *return_sequence =3D NULL; char *char_tmp =3D NULL; - unsigned char *hex_tmp =3D NULL; char tmp[12]; int len; sdp_attribute_search search_struct; @@ -703,19 +692,13 @@ char_tmp =3D get_values(search_struct.attrlist, search_struct.attrlist_i= ndex, fd); len =3D strlen(char_tmp) / 2; =20 - hex_tmp =3D char2hex(char_tmp); - return_sequence =3D malloc(len + 2); D_MEM("---> malloc%d %d bytes at 0x%8p", malloc_dbg++, len + 2, return_s= equence); =20=20=20 return_sequence[0] =3D 0x35; return_sequence[1] =3D len; - memcpy(return_sequence + 2, hex_tmp, len); + char2hex(char_tmp, return_sequence + 2); =20=20=20 - D_MEM("<--- free%d 0x%8p", --malloc_dbg, char_tmp); - free(char_tmp); - D_MEM("<--- free%d 0x%8p", --malloc_dbg, hex_tmp); - free(hex_tmp); D_MEM("<--- free%d 0x%8p", --malloc_dbg, search_struct.attribute_name); free(search_struct.attribute_name); D_MEM("<--- free%d 0x%8p", --malloc_dbg, search_struct.service_class); |
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)) |
From: Peter K. <pk...@us...> - 2001-03-27 18:12:49
|
The following file was modified in apps/bluetooth/sdp_server: Name Old version New version Comment ---- ----------- ----------- ------- sdp_server.c 1.25 1.26=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * Handle failed memory allocations. * Fixed a couple of memory leaks. * Fixed too small allocations in get_start(). The diff of the modified file(s): --- sdp_server.c 2001/03/26 16:06:45 1.25 +++ sdp_server.c 2001/03/27 18:12:47 1.26 @@ -204,6 +204,12 @@ return tmp; } =20 +int +is_err(void) +{ + return parse_err !=3D 0; +} + void start_xml_parser(XML_Parser p, int fd) { @@ -238,6 +244,11 @@ fprintf(stderr, "len:%d\n",len); break; } + + if (is_err()) + { + break; + } } while (len); } =20 @@ -464,6 +475,12 @@ s_hdl->hdl_list_max +=3D 16; tmp =3D realloc(s_hdl->hdl_list, s_hdl->hdl_list_max * sizeof *s_h= dl->hdl_list); D_MEM("---> realloc%d %ld bytes at 0x%8p", malloc_dbg++, s_hdl->hd= l_list_max * sizeof *s_hdl->hdl_list, tmp); + if (!tmp) + { + set_err(SDP_INSUFFICIENT_RESOURCES); + s_hdl->hdl_list_max -=3D 16; + return; + } =20 s_hdl->hdl_list =3D tmp; } @@ -510,6 +527,13 @@ s_hdl.hdl_list_max =3D 16; s_hdl.hdl_list =3D malloc(s_hdl.hdl_list_max * sizeof *s_hdl.hdl_list); D_MEM("---> malloc%d %ld bytes at 0x%8p", malloc_dbg++, s_hdl.hdl_list_m= ax * sizeof *s_hdl.hdl_list, s_hdl.hdl_list); + if (!s_hdl.hdl_list) + { + set_err(SDP_INSUFFICIENT_RESOURCES); + D_MEM("<--- free%d 0x%8p", --malloc_dbg, s_hdl.uuid); + free(s_hdl.uuid); + return NULL; + } =20 p =3D XML_ParserCreate(NULL); XML_SetElementHandler(p, get_more_rec_hdl_start, get_more_rec_hdl_end); @@ -519,15 +543,33 @@ start_xml_parser(p, fd); XML_ParserFree(p); =20 + D_MEM("<--- free%d 0x%8p", --malloc_dbg, s_hdl.uuid); + free(s_hdl.uuid); + + if (is_err()) + { + D_MEM("<--- free%d 0x%8p", --malloc_dbg, s_hdl.hdl_list); + free(s_hdl.hdl_list); + return NULL; + } + if (s_hdl.hdl_list_len >=3D s_hdl.hdl_list_max) { - s_hdl.hdl_list_max =3D s_hdl.hdl_list_len + 1; + s_hdl.hdl_list_max++; =20 tmp =3D realloc(s_hdl.hdl_list, s_hdl.hdl_list_max * sizeof *s_hdl.hdl= _list); D_MEM("---> realloc%d %ld bytes at 0x%8p", malloc_dbg++, s_hdl.hdl_lis= t_max * sizeof *s_hdl.hdl_list, tmp); + if (!tmp) + { + set_err(SDP_INSUFFICIENT_RESOURCES); + D_MEM("<--- free%d 0x%8p", --malloc_dbg, s_hdl.hdl_list); + free(s_hdl.hdl_list); + return NULL; + } =20 s_hdl.hdl_list =3D tmp; } + s_hdl.hdl_list[s_hdl.hdl_list_len++] =3D NO_REC_HDL; =20 return s_hdl.hdl_list; @@ -544,6 +586,11 @@ /* FIXME: But for now 256 bytes will do */ return_sequence =3D malloc(256); D_MEM("---> malloc%d %d bytes at 0x%8p", malloc_dbg++, 256, return_seque= nce); + if (!return_sequence) + { + set_err(SDP_INSUFFICIENT_RESOURCES); + return NULL; + } =20 D_ATTR("A range of attributes was requested 0x%04x - 0x%04x", (attr_id_code >> 16), (attr_id_code & 0xffff)); @@ -551,6 +598,13 @@ /* Lists all attributes registerd in the database */ attr_lst =3D get_all_attributes(fd); =20=20=20 + if (!attr_lst) + { + D_MEM("<--- free%d 0x%8p", --malloc_dbg, return_sequence); + free(return_sequence); + return NULL; + } +=20=20 return_sequence[pos++] =3D DES_HDR; return_sequence[pos++] =3D 0; =20=20=20 @@ -576,6 +630,12 @@ D_MEM("<--- free%d 0x%8p", --malloc_dbg, tmp_ptr); free(tmp_ptr); } + else if (is_err()) + { + D_MEM("<--- free%d 0x%8p", --malloc_dbg, return_sequence); + free(return_sequence); + return NULL; + } i++; } =20=20=20 @@ -587,6 +647,7 @@ =20=20=20 if (return_sequence[1] =3D=3D 0) { + D_MEM("<--- free%d 0x%8p", --malloc_dbg, return_sequence); free(return_sequence); return NULL; } @@ -667,10 +728,26 @@ start_xml_parser(p, fd); XML_ParserFree(p); =20 + if (is_err()) + { + D_MEM("<--- free%d 0x%8p", --malloc_dbg, search_struct.attribute_name); + free(search_struct.attribute_name); + D_MEM("<--- free%d 0x%8p", --malloc_dbg, search_struct.service_class); + free(search_struct.service_class); + + return NULL; + } + if (search_struct.attrlist_index =3D=3D 0) { D_ATTR("Didn't find the attribute values for the attribute %s", search_struct.attribute_name); + + D_MEM("<--- free%d 0x%8p", --malloc_dbg, search_struct.attribute_name); + free(search_struct.attribute_name); + D_MEM("<--- free%d 0x%8p", --malloc_dbg, search_struct.service_class); + free(search_struct.service_class); + return NULL; } =20=20=20 @@ -679,7 +756,17 @@ =20 return_sequence =3D malloc(len + 2); D_MEM("---> malloc%d %d bytes at 0x%8p", malloc_dbg++, len + 2, return_s= equence); + if (!return_sequence) + { + set_err(SDP_INSUFFICIENT_RESOURCES); + D_MEM("<--- free%d 0x%8p", --malloc_dbg, search_struct.attribute_name); + free(search_struct.attribute_name); + D_MEM("<--- free%d 0x%8p", --malloc_dbg, search_struct.service_class); + free(search_struct.service_class); =20=20=20 + return NULL; + } +=20=20 return_sequence[0] =3D 0x35; return_sequence[1] =3D len; char2hex(char_tmp, return_sequence + 2); @@ -907,9 +994,10 @@ {=20=20=20=20 if (set_value !=3D -1) { - fprintf(stderr, __FUNCTION__ ": Error more the one attribute =3D=3D = NULL\n"); + fprintf(stderr, __FUNCTION__ ": Error more than one attribute =3D=3D= NULL\n"); return NULL; } + S_FNC("Looking for attribute"); set_value =3D ATTR; } @@ -918,9 +1006,10 @@ { if (set_value !=3D -1) { - fprintf(stderr, __FUNCTION__ ": Error more the one attribute =3D=3D = NULL\n"); + fprintf(stderr, __FUNCTION__ ": Error more than one attribute =3D=3D= NULL\n"); return NULL; } + S_FNC("Looking for value"); set_value =3D VAL; } @@ -932,16 +1021,15 @@ { case TAG: return search_hdl.search_name; - break; + case ATTR: return search_hdl.search_attr; - break; + case VAL: return search_hdl.search_val; - break; + default: return NULL; - break; } =20=20=20 #undef TAG @@ -967,10 +1055,13 @@ if (strcmp(attr[i + 1], search_hdl->search_val) =3D=3D 0) { S_FNC("Found %s", attr[i]); - m_size =3D strlen(attr[i] + 1); + m_size =3D strlen(attr[i]) + 1; search_hdl->search_attr =3D malloc(m_size); D_MEM("---> malloc%d %d bytes at 0x%8p", malloc_dbg++, m_size, s= earch_hdl->search_attr); + if (search_hdl->search_attr) + { strcpy(search_hdl->search_attr, attr[i]); + } return; } } @@ -986,10 +1077,13 @@ if (strcmp(attr[i], search_hdl->search_attr) =3D=3D 0) { S_FNC("Found %s", attr[i + 1]); - m_size =3D strlen(attr[i + 1] + 1); + m_size =3D strlen(attr[i + 1]) + 1; search_hdl->search_val =3D malloc(m_size); D_MEM("---> malloc%d %d bytes at 0x%8p", malloc_dbg++, m_size, s= earch_hdl->search_val); + if (search_hdl->search_val) + { strcpy(search_hdl->search_val, attr[i + 1]); + } return; } } @@ -1005,7 +1099,10 @@ m_size =3D strlen(el) + 1; search_hdl->search_name =3D malloc(m_size); D_MEM("---> malloc%d %d bytes at 0x%8p", malloc_dbg++, m_size, sea= rch_hdl->search_name); + if (search_hdl->search_name) + { strcpy(search_hdl->search_name, el); + } return; } } @@ -1039,18 +1136,13 @@ =20 attr_lst =3D (unsigned int*)search_hdl.search_val; =20 - for (i =3D 1; i <=3D attr_lst[0]; i++) - { - D_ATTR("Before free Attribute %d: 0x%04x", i , attr_lst[i]); - } - XML_ParserFree(p); =20=20=20 /* If we didn't find the service class we return here */ - if (search_hdl.search_val =3D=3D NULL) + if (!attr_lst) { D_ATTR("Didn't find anything"); - return 0; + return NULL; } =20 for (i =3D 1; i <=3D attr_lst[0]; i++) @@ -1070,6 +1162,8 @@ =20=20=20 if (strncmp(el, search_hdl->search_name, strlen(search_hdl->search_name)= ) =3D=3D0) { + unsigned int *attributes; + S_FNC("Found %s", el); attr_cnt =3D XML_GetSpecifiedAttributeCount((XML_Parser*) data); /* Since attr_cnt is the count of both the attibutes and the attribute @@ -1079,15 +1173,23 @@ S_FNC("%d attributes found", attr_cnt); /* Allocate space for all the attribute UUIDs plus the attribute count in the search_output pointer, */ - m_size =3D attr_cnt * 4 + 4; + m_size =3D (attr_cnt + 1) * sizeof *attributes; search_hdl->search_val =3D malloc(m_size); - D_MEM("---> malloc%d %d bytes at 0x%8p", malloc_dbg++, m_size, search_= hdl->search_val); - memcpy(search_hdl->search_val, &attr_cnt, 4); + attributes =3D (unsigned int *)search_hdl->search_val; + D_MEM("---> malloc%d %d bytes at 0x%8p", malloc_dbg++, m_size, attribu= tes); + + if (!attributes) + { + set_err(SDP_INSUFFICIENT_RESOURCES); + return; + } + + *attributes++ =3D (unsigned int)attr_cnt; for (i =3D 0; attr[i]; i +=3D 2) { unsigned int tmp =3D strtoul(attr[i + 1], NULL, 16);=20 =20 - memcpy(search_hdl->search_val + 4 +(i * 2), &tmp ,4); + *attributes++ =3D tmp; S_FNC("Attribute %d found", tmp); }=20 } @@ -1148,6 +1250,8 @@ =20=20=20 rec_hdl =3D get_record_handle(db_hdl->service_class_list[0], xml_fd); =20 + D_REC("Got Record handle: 0x%08x", rec_hdl); + if (rec_hdl !=3D NO_REC_HDL) { rec_hdl_cnt++; @@ -1155,11 +1259,17 @@ =20 rec_hdl_list =3D get_more_rec_hdl(db_hdl->service_class_list[0], xml_fd); =20=20=20 - D_REC("Got Record handle: 0x%08x", rec_hdl); + if (is_err()) + { + D_MEM("<--- free%d 0x%8p", --malloc_dbg, rec_hdl_list); + free(rec_hdl_list); + send_error_rsp(db_hdl->db.sdp_con_id, db_hdl->db.trans_id, get_err()); + return; + } +=20=20 if (rec_hdl_list) { - i =3D 0; - while (rec_hdl_list[i] !=3D NO_REC_HDL) + for (i =3D 0; rec_hdl_list[i] !=3D NO_REC_HDL; i++) { D_REC("Got Record handle: 0x%08x", rec_hdl_list[i]); if (rec_hdl =3D=3D rec_hdl_list[i]) @@ -1167,7 +1277,6 @@ rec_hdl_cnt--; rec_hdl =3D NO_REC_HDL; } - i++; } rec_hdl_cnt +=3D i; } @@ -1208,6 +1317,12 @@ =20 rsp_pkt_len =3D set_cont_state_search(rsp_pkt, rsp_pkt_len, db_hdl->max_= rec_cnt); =20 + if (is_err()) + { + send_error_rsp(db_hdl->db.sdp_con_id, db_hdl->db.trans_id, get_err()); + return; + } +=20=20 write2stack(db_hdl->db.sdp_con_id, rsp_pkt, rsp_pkt_len);=20 } =20 @@ -1235,6 +1350,7 @@ { tmp_ptr =3D get_attribute_list(xml_fd, db_hdl->rec_hdl, db_hdl->attr= _list[i]); } + if (tmp_ptr) { memcpy(rsp_pkt + rsp_pkt_len, tmp_ptr + 2, tmp_ptr[1]); @@ -1243,17 +1359,12 @@ D_MEM("<--- free %d 0x%8p", --malloc_dbg, tmp_ptr); free(tmp_ptr); } - else - { - int err =3D get_err(); - - if (err) + else if (is_err()) { - send_error_rsp(db_hdl->db.sdp_con_id, db_hdl->db.trans_id, err); + send_error_rsp(db_hdl->db.sdp_con_id, db_hdl->db.trans_id, get_err()= ); return; } } - } =20 /* Set the attribute byte count to packet length minus sdp pdu header si= ze minus attribute byte count field length, minus continuation field len= gth*/ @@ -1269,6 +1380,12 @@ =20 rsp_pkt_len =3D set_cont_state_attr(rsp_pkt, rsp_pkt_len,db_hdl->max_att= r_byte_cnt); =20 + if (is_err()) + { + send_error_rsp(db_hdl->db.sdp_con_id, db_hdl->db.trans_id, get_err()); + return; + } +=20=20 write2stack(db_hdl->db.sdp_con_id, rsp_pkt, rsp_pkt_len);=20 } =20 @@ -1288,6 +1405,14 @@ =20=20=20 rec_hdl_list =3D get_more_rec_hdl(db_hdl->service_class_list[0], xml_fd); =20=20=20 + if (is_err()) + { + D_MEM("<--- free%d 0x%8p", --malloc_dbg, rec_hdl_list); + free(rec_hdl_list); + send_error_rsp(db_hdl->db.sdp_con_id, db_hdl->db.trans_id, get_err()); + return; + } +=20=20 rec_hdl_cnt =3D 0; if (rec_hdl_list) { @@ -1314,6 +1439,9 @@ rsp_pkt_len +=3D 2; =20 if (!rec_hdl_cnt) { + D_MEM("<--- free%d 0x%8p", --malloc_dbg, rec_hdl_list); + free(rec_hdl_list); + rec_hdl_cnt =3D 1; rec_hdl_list =3D &rec_hdl; } @@ -1342,6 +1470,16 @@ D_MEM("<--- free%d tmp_ptr 0x%8p", --malloc_dbg, tmp_ptr); free(tmp_ptr); } + else if (is_err()) + { + if (rec_hdl_list !=3D &rec_hdl) + { + D_MEM("<--- free%d 0x%8p", --malloc_dbg, rec_hdl_list); + free(rec_hdl_list); + } + send_error_rsp(db_hdl->db.sdp_con_id, db_hdl->db.trans_id, get_err= ()); + return; + } } if (tmp_len > 2)=20 { @@ -1372,6 +1510,12 @@ =20=20=20 rsp_pkt_len =3D set_cont_state_attr(rsp_pkt, rsp_pkt_len,db_hdl->max_att= r_byte_cnt); =20=20=20 + if (is_err()) + { + send_error_rsp(db_hdl->db.sdp_con_id, db_hdl->db.trans_id, get_err()); + return; + } +=20=20 /* FIXME: Add features to handle continuation state packets */ write2stack(db_hdl->db.sdp_con_id, rsp_pkt, rsp_pkt_len);=20 } @@ -1405,6 +1549,12 @@ cont_state_buf =3D malloc(sizeof(cont_state_struct) + cnt_len); D_MEM("---> malloc%d %ld bytes at 0x%8p", malloc_dbg++, sizeof(cont_st= ate_struct) + cnt_len, cont_state_buf); =20 + if (!cont_state_buf) + { + set_err(SDP_INSUFFICIENT_RESOURCES); + return 0; + } +=20=20=20=20 cont_state_buf->pdu =3D pkt[SDP_HDR_TYPE]; D_MISC("PDU: 0x%02x", cont_state_buf->pdu); =20=20=20=20=20 @@ -1456,6 +1606,12 @@ cont_state_buf =3D malloc(sizeof(cont_state_struct) + cont_len); D_MEM("---> malloc%d %ld bytes at 0x%8p", malloc_dbg++, sizeof(cont_st= ate_struct) + cont_len , cont_state_buf); =20 + if (!cont_state_buf) + { + set_err(SDP_INSUFFICIENT_RESOURCES); + return 0; + } +=20=20=20=20 cont_state_buf->pdu =3D pkt[SDP_HDR_TYPE]; D_MISC("PDU: 0x%02x", cont_state_buf->pdu); =20 @@ -1501,6 +1657,11 @@ =20 send_buf =3D malloc(send_len); D_MEM("---> malloc%d %d bytes at 0x%8p", malloc_dbg++, send_len, send_= buf); + if (!send_buf) + { + send_error_rsp(sdp_con_id, trans_id, SDP_INSUFFICIENT_RESOURCES); + return; + } =20 set_sdp_hdr(send_buf, cont_state_buf->pdu, trans_id, send_len - SDP_HD= R_SIZE); =20 @@ -1519,12 +1680,12 @@ /* Send the whole buffer */ write2stack(sdp_con_id, send_buf, send_len); =20 + D_MEM("<--- free%d 0x%8p", --malloc_dbg, send_buf); + free(send_buf); + D_MEM("<--- free%d 0x%8p", --malloc_dbg, cont_state_buf); free(cont_state_buf); cont_state_buf =3D NULL; - - D_MEM("<--- free%d 0x%8p", --malloc_dbg, send_buf); - free(send_buf); } else { @@ -1546,9 +1707,7 @@ if (!cont_state_buf) { send_error_rsp(sdp_con_id, trans_id, SDP_INVALID_CONTINUATION_STATE); } - else - { - if (max_attr_cnt >=3D cont_state_buf->len) + else if (max_attr_cnt >=3D cont_state_buf->len) { /* Allocate space for the SDP header, the attribute byte count field, the attributes and the continuation state field */ @@ -1556,6 +1715,11 @@ =20 send_buf =3D malloc(send_len); D_MEM("---> malloc%d %d bytes at 0x%8p", malloc_dbg++, send_len, sen= d_buf); + if (!send_buf) + { + send_error_rsp(sdp_con_id, trans_id, SDP_INSUFFICIENT_RESOURCES); + return; + } =20 set_sdp_hdr(send_buf, cont_state_buf->pdu, trans_id, send_len - SDP_= HDR_SIZE); =20 @@ -1570,12 +1734,12 @@ /* Send the whole buffer */ write2stack(sdp_con_id, send_buf, send_len); =20 + D_MEM("<--- free%d 0x%8p", --malloc_dbg, send_buf); + free(send_buf); + D_MEM("<--- free%d 0x%8p", --malloc_dbg, cont_state_buf); free(cont_state_buf); cont_state_buf =3D NULL; - - D_MEM("<--- free%d 0x%8p", --malloc_dbg, send_buf); - free(send_buf); } else { @@ -1584,6 +1748,5 @@ /* FIXME: Have to implement this too... */ =20 send_error_rsp(sdp_con_id, trans_id, SDP_INVALID_SDP_VERSION); - } } } |
From: Mats F. <ma...@us...> - 2001-06-19 08:38:30
|
The following file was modified in apps/bluetooth/sdp_server: Name Old version New version Comment ---- ----------- ----------- ------- sdp_server.c 1.28 1.29=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Should not free rec_hdl_list, since it is declared as static The diff of the modified file(s): --- sdp_server.c 2001/06/14 10:30:42 1.28 +++ sdp_server.c 2001/06/19 08:19:37 1.29 @@ -422,8 +422,8 @@ rec_hdl_list_out[cnt_out] =3D rec_hdl_list_in[i]; D_RHDL(__FUNCTION__": Found record_handle 0x%08x", rec_hdl_list_out[cnt_o= ut]); cnt_out++; - existing =3D FALSE; } + existing =3D FALSE; } =20 rec_hdl_list_out[cnt_out] =3D NO_REC_HDL; @@ -1473,23 +1473,23 @@ =20 rec_hdl_list =3D get_all_rec_hdl(db_hdl->service_class_list, db_hdl->ser= vice_class_cnt); =20=20=20 + D_REC("Got a record handle list"); +=20=20 if (is_err()) - { - if (rec_hdl_list) { - D_MEM("<--- free%d 0x%8p", --malloc_dbg, rec_hdl_list); - free(rec_hdl_list); - } + D_REC("Error occured, sending error response"); send_error_rsp(&db_hdl->db, get_err()); return; } =20 if (rec_hdl_list) { + rec_hdl_cnt =3D 0; while (rec_hdl_list[rec_hdl_cnt] !=3D NO_REC_HDL) { rec_hdl_cnt++; } + D_REC("Found %d record handles", rec_hdl_cnt); } =20=20=20 /* Skip the sdp header and the attribute byte count field */ @@ -1525,11 +1525,6 @@ } else if (is_err()) { - if (rec_hdl_list) - { - D_MEM("<--- free%d 0x%8p", --malloc_dbg, rec_hdl_list); - free(rec_hdl_list); - } send_error_rsp(&db_hdl->db, get_err()); return; } @@ -1540,11 +1535,6 @@ rsp_pkt[rsp_pkt_len + 1] =3D tmp_len - 2; rsp_pkt_len +=3D tmp_len; } - } - if (rec_hdl_list) - { - D_MEM("<--- free%d 0x%8p", --malloc_dbg, rec_hdl_list); - free(rec_hdl_list); } =20 /* Set the attribute byte count to packet length minus sdp pdu header si= ze |
From: Mattias A. <mat...@us...> - 2001-08-22 17:46:38
|
The following file was modified in apps/bluetooth/sdp_server: Name Old version New version Comment ---- ----------- ----------- ------- sdp_server.c 1.29 1.30=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * fixed bug when handling MaximumServiceRecordCount in service search * changed some debug printouts * corrected spelling * added comments The diff of the modified file(s): --- sdp_server.c 2001/06/19 08:19:37 1.29 +++ sdp_server.c 2001/08/22 17:46:37 1.30 @@ -124,7 +124,7 @@ void set_sdp_hdr(unsigned char *hdr, unsigned char pkt_type, unsigned short trans_id, unsigned short len); =20 -unsigned int* remove_dublicated_rec_hdl(unsigned int *rec_hdl_list_in, +unsigned int* remove_duplicated_rec_hdl(unsigned int *rec_hdl_list_in, unsigned int cnt_in); unsigned int* get_all_rec_hdl(unsigned int *service_class_list, unsigned int service_class_cnt); @@ -276,11 +276,14 @@ int value_string_pos =3D 0; static char tmp_list[256]; char tmp_len =3D 0; - char *des_pos[DES_HDR_DEPTH]; /* des stands for Data Elemet Sequence */ + char *des_pos[DES_HDR_DEPTH]; /* des stands for Data Element Sequence */ int des_len[DES_HDR_DEPTH]; char c_des_len[3][DES_HDR_DEPTH]; int i; =20 + D_MISC(__FUNCTION__" value_string _%s_, valstrlen:%d\n",=20 + value_string, value_string_len); + i =3D 0; while (i < value_string_len) { @@ -299,6 +302,8 @@ /* If we found a hex value instead of a string */ if (strncmp(value_string + value_string_pos, "0x", 2) =3D=3D 0) { + D_MISC("Found HEX val\n"); + strcpy(tmp_list + tmp_len, value_string + value_string_pos + 2); tmp_len +=3D strlen(value_string + value_string_pos) - 2; =20 @@ -314,6 +319,7 @@ =20 /* Now we found a data element sequence header inside another data element sequence */ + if (des_pos[pos]) { sprintf(c_des_len[pos], "%02x", des_len[pos]); @@ -321,8 +327,10 @@ strncpy(des_pos[pos], c_des_len[pos], 2); D_MISC("des_pos[%d]: %s", pos, des_pos[pos]); } + 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; @@ -339,6 +347,9 @@ { char *tmp_code; =20 + D_MISC("Searching xml file : TAG SDPTranslationRegister\n"); + D_MISC("String : _%s_\n", value_string+value_string_pos); +=20=20=20=20=20=20 /* Get the hex code for the attribute from the xml file */ tmp_code =3D get_from_xml(fd, "SDPTranslationRegister", value_string + value_string_pos, NULL); @@ -401,7 +412,7 @@ } =20 unsigned int* -remove_dublicated_rec_hdl(unsigned int *rec_hdl_list_in, unsigned int cnt_= in)=20=20 +remove_duplicated_rec_hdl(unsigned int *rec_hdl_list_in, unsigned int cnt_= in)=20=20 { static unsigned int rec_hdl_list_out[128]; unsigned int i, j, cnt_out =3D 0; @@ -420,7 +431,7 @@ if(!existing) { rec_hdl_list_out[cnt_out] =3D rec_hdl_list_in[i]; - D_RHDL(__FUNCTION__": Found record_handle 0x%08x", rec_hdl_list_out[cnt_o= ut]); + D_RHDL(__FUNCTION__": |||=A0Keeping record_handle 0x%08x |||", rec_hdl_li= st_out[cnt_out]); cnt_out++; } existing =3D FALSE; @@ -439,14 +450,14 @@ unsigned int rec_hdl_cnt =3D 0; int i, j; =20=20=20 - D_RHDL(__FUNCTION__": service_class_cnt:%d", service_class_cnt); + D_RHDL(__FUNCTION__": Searching for %d UUID:s...", service_class_cnt); =20 for (i =3D 0; i < service_class_cnt; i++) { - D_RHDL(__FUNCTION__": Service Class:0x%08x", service_class_list[i]); + D_RHDL(__FUNCTION__": Now search for UUID : 0x%08x", service_class_lis= t[i]); if ((rec_hdl_list[rec_hdl_cnt] =3D get_record_handle(service_class_lis= t[i], xml_fd)) !=3D NO_REC_HDL) { - D_REC("Got Record handle1: 0x%08x", rec_hdl_list[rec_hdl_cnt]); + D_REC("Found record handle : 0x%08x", rec_hdl_list[rec_hdl_cnt]); rec_hdl_cnt++; } =20=20=20=20=20=20=20=20=20 @@ -465,22 +476,30 @@ while (tmp_hdl_list[j] !=3D NO_REC_HDL) { rec_hdl_list[rec_hdl_cnt] =3D tmp_hdl_list[j]; - D_REC("Got Record handle2: 0x%08x", rec_hdl_list[rec_hdl_cnt]); + D_REC("Found record handle : 0x%08x", rec_hdl_list[rec_hdl_cnt]); rec_hdl_cnt++; j++; } =20=20=20=20=20=20=20 + D_RHDL("Found %d record handles using get_more_rec_hdl\n", j); +=20=20=20=20=20=20 D_MEM("<--- free%d 0x%8p", --malloc_dbg, tmp_hdl_list); free(tmp_hdl_list); } =20=20=20=20=20 } =20=20=20 - tmp_hdl_list =3D remove_dublicated_rec_hdl(rec_hdl_list, rec_hdl_cnt); + D_RHDL("Now __remove__ duplicated entries ?!?!?\n"); +=20 + tmp_hdl_list =3D remove_duplicated_rec_hdl(rec_hdl_list, rec_hdl_cnt); =20=20 return tmp_hdl_list; } =20 + +/*=20 + * Searches for "ServiceClasses" entries in database=20 + */ unsigned int get_record_handle(unsigned short service_class, int fd) { @@ -489,11 +508,14 @@ char *service_class_id =3D NULL; char tmp[12]; =20 + D_RHDL("Looking for service class %0x\n", service_class); + /* Before we can get the recordhandle we have to find the name of the service class, so we can search for it in the database. When we search the service class id, have to be converted to characters. All service classes are stored as 16 bits UUIDs*/ =20 + /* Search for UUID as a string among ServiceClasses TAG */ sprintf(tmp, "0x%04x", service_class); service_class_name =3D get_from_xml(fd, "ServiceClasses", NULL, tmp);=20 =20 @@ -504,9 +526,9 @@ return NO_REC_HDL; } =20 - /* Otherwise we got the name for the service class, and we can contiue - searching for the record handle */ + D_RHDL("Found service class name %s\n", service_class_name); =20 + /* We found service class name, now search for record handle */ service_class_id =3D get_from_xml(fd, service_class_name, "ServiceRecordHandle", NULL); =20 @@ -516,9 +538,9 @@ /* If we found the record handle we convert it to an unsigned int */ if (service_class_id !=3D NULL) { - D_RHDL("Found %s", service_class_id); + D_RHDL("Found service_class_id : 0x%x\n", service_class_id); record_handle =3D strtoul(service_class_id, NULL, 16); - D_RHDL("Record handle converted to int 0x%08x", record_handle); + D_RHDL("Service class id conv to rec hdl 0x%08x", record_handle); D_MEM("<--- free%d 0x%8p", --malloc_dbg, service_class_id); free(service_class_id); } @@ -581,6 +603,9 @@ { } =20 +/*=20 + * Searches for Attributes in database=20 + */ unsigned int* get_more_rec_hdl(unsigned short service_class, int fd) { @@ -591,6 +616,9 @@ XML_Parser p; =20 sprintf(tmp_ch, "0x%04x", service_class); + + /* Search for UUID among "Protocols" TAG */ + s_hdl.uuid =3D get_from_xml(fd, "Protocols", NULL, tmp_ch);=20 =20 /* If we didn't find the service class among the protocols we look for it @@ -1351,12 +1379,28 @@ } } =20=20=20 + D_MISC("Found %d rec handles in database\n", rec_hdl_cnt); + + /* Calculate how many records we can fit into response */ + /* SdpHdrSize[5] + TotSrvCnt[2] + CurSrvRevCnt[2] + possibl ContState[2]= =20 + =3D> 11 bytes. Each rec hdl is 4 bytes */ + + max_rec_cnt =3D MIN(db_hdl->max_rec_cnt, (db_hdl->db.l2cap_mtu - 11)/4); + + if (rec_hdl_cnt > max_rec_cnt)=20 + { + D_REC("Only send %d out of %d record handles\n", max_rec_cnt, rec_hdl_= cnt); + rec_hdl_cnt =3D max_rec_cnt; + } +=20=20 rsp_pkt_len =3D SDP_HDR_SIZE;=20=20 =20=20=20 /* Set the total service record count */ rsp_pkt[rsp_pkt_len++] =3D SHORT2CHAR_MS(rec_hdl_cnt); rsp_pkt[rsp_pkt_len++] =3D SHORT2CHAR_LS(rec_hdl_cnt); =20=20=20 + /* fixme -- total/current should probably differ sometimes... */ +=20=20 /* Set the current service record count */ rsp_pkt[rsp_pkt_len++] =3D SHORT2CHAR_MS(rec_hdl_cnt); rsp_pkt[rsp_pkt_len++] =3D SHORT2CHAR_LS(rec_hdl_cnt); @@ -1375,11 +1419,19 @@ set_sdp_hdr(rsp_pkt, SDP_SERVICESEARCH_RSP, db_hdl->db.trans_id, rsp_pkt_len - SDP_HDR_SIZE); =20 - max_rec_cnt =3D MIN(db_hdl->max_rec_cnt, db_hdl->db.l2cap_mtu - 11); - /* 11 comes from SDP_HDR_SIZE + tot+cur-rec cnt fiel + 2 bytes for cont + D_REC("l2cap_mtu:%d, mrc:%d, db->mrc:%d\n", db_hdl->db.l2cap_mtu, max_re= c_cnt, db_hdl->max_rec_cnt); + + /* If Max Service Record Count is set to a value less than the number of + available records in database we should not set cont state */ + + /* set_cont_state_search searches rsp_pkt for currently set rec cnt=20 + and we compare that with max_rec_cnt. If current is larger than + max rec cnt, we set continuation state and change headers in rsp + packet. If not we simply put a 0 in the end to indicate no cont=20 state */ =20 - D_REC("l2cap_mtu:%d, mrc:%d, db->mrc:%d\n", db_hdl->db.l2cap_mtu, max_re= c_cnt, db_hdl->max_rec_cnt); + /* fixme -- as of today we can only handle continuation state for=20 + 1 client at a time */ =20=20=20 rsp_pkt_len =3D set_cont_state_search(rsp_pkt, rsp_pkt_len, max_rec_cnt); =20 @@ -1616,8 +1668,10 @@ } else { + D_MISC("No continuation state set\n"); pkt[len++] =3D 0; } +=20=20 =20=20=20 /* Change the length field */ pkt[SDP_HDR_LENGTH_MS] =3D SHORT2CHAR_MS(len - SDP_HDR_SIZE); |
From: Peter K. <pk...@us...> - 2001-11-19 08:43:03
|
The following file was modified in apps/bluetooth/sdp_server: Name Old version New version Comment ---- ----------- ----------- ------- sdp_server.c 1.30 1.31=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Use <> instead of "" when including xmlparse.h The diff of the modified file(s): --- sdp_server.c 2001/08/22 17:46:37 1.30 +++ sdp_server.c 2001/11/19 08:43:02 1.31 @@ -46,7 +46,8 @@ #include <syslog.h> #include <unistd.h> =20 -#include "xmlparse.h" +#include <xmlparse.h> + #include "sdp_server.h" #include "sdp_parser.h" =20 |
From: Anders J. <and...@us...> - 2003-03-29 18:44:57
|
The following file was modified in apps/bluetooth/sdp_server: Name Old version New version Tag Comment ---- ----------- ----------- --- ------- sdp_server.c 1.32 1.33=20=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Corrected read of the attribute-list. The diff of the modified file(s): --- sdp_server.c 7 Mar 2002 21:23:19 -0000 1.32 +++ sdp_server.c 29 Mar 2003 18:44:56 -0000 1.33 @@ -723,14 +723,14 @@ return_sequence[pos++] =3D 0; =20=20=20 /* Find the first attribute in the range */ - while ((i < attr_lst[0]) && (attr_lst[i] < (attr_id_code >> 16))) + while ((i <=3D attr_lst[0]) && (attr_lst[i] < (attr_id_code >> 16))) { i++; } D_ATTR("attr_lst[0]: %d, attr_id_code: 0x%04x", attr_lst[0], attr_id_code); =20=20=20 - while ((i < attr_lst[0]) && (attr_lst[i] <=3D (attr_id_code & 0xffff))) + while ((i <=3D attr_lst[0]) && (attr_lst[i] <=3D (attr_id_code & 0xffff)= )) { D_REC("attr_lst[%d]: 0x%04x", i, attr_lst[i]); /* we mask the attribute her so we don't by misstake send a range as |