Loading system/bta/pan/bta_pan_act.cc +18 −27 Original line number Diff line number Diff line Loading @@ -171,28 +171,25 @@ static void bta_pan_data_flow_cb(uint16_t handle, tPAN_RESULT result) { static void bta_pan_data_buf_ind_cback(uint16_t handle, const RawAddress& src, const RawAddress& dst, uint16_t protocol, BT_HDR* p_buf, bool ext, bool forward) { tBTA_PAN_SCB* p_scb; BT_HDR* p_new_buf; tBTA_PAN_SCB* p_scb = bta_pan_scb_by_handle(handle); if (p_scb == NULL) { return; } if (sizeof(tBTA_PAN_DATA_PARAMS) > p_buf->offset) { /* offset smaller than data structure in front of actual data */ if (sizeof(BT_HDR) + sizeof(tBTA_PAN_DATA_PARAMS) + p_buf->len > PAN_BUF_SIZE) { android_errorWriteLog(0x534e4554, "63146237"); APPL_TRACE_ERROR("%s: received buffer length too large: %d", __func__, p_buf->len); osi_free(p_buf); return; } p_new_buf = (BT_HDR*)osi_malloc(PAN_BUF_SIZE); BT_HDR* p_new_buf = (BT_HDR*)osi_malloc(PAN_BUF_SIZE); memcpy((uint8_t*)(p_new_buf + 1) + sizeof(tBTA_PAN_DATA_PARAMS), (uint8_t*)(p_buf + 1) + p_buf->offset, p_buf->len); p_new_buf->len = p_buf->len; p_new_buf->offset = sizeof(tBTA_PAN_DATA_PARAMS); osi_free(p_buf); } else { p_new_buf = p_buf; } /* copy params into the space before the data */ ((tBTA_PAN_DATA_PARAMS*)p_new_buf)->src = src; ((tBTA_PAN_DATA_PARAMS*)p_new_buf)->dst = dst; Loading @@ -200,12 +197,6 @@ static void bta_pan_data_buf_ind_cback(uint16_t handle, const RawAddress& src, ((tBTA_PAN_DATA_PARAMS*)p_new_buf)->ext = ext; ((tBTA_PAN_DATA_PARAMS*)p_new_buf)->forward = forward; p_scb = bta_pan_scb_by_handle(handle); if (p_scb == NULL) { osi_free(p_new_buf); return; } fixed_queue_enqueue(p_scb->data_queue, p_new_buf); BT_HDR* p_event = (BT_HDR*)osi_malloc(sizeof(BT_HDR)); p_event->layer_specific = handle; Loading system/btif/src/btif_rc.cc +7 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ #include "btif_util.h" #include "btu.h" #include "device/include/interop.h" #include "log/log.h" #include "osi/include/list.h" #include "osi/include/osi.h" #include "osi/include/properties.h" Loading Loading @@ -3539,6 +3540,12 @@ static void handle_app_cur_val_response(tBTA_AV_META_MSG* pmeta_msg, app_settings.num_attr = p_rsp->num_val; if (app_settings.num_attr > BTRC_MAX_APP_SETTINGS) { android_errorWriteLog(0x534e4554, "73824150"); app_settings.num_attr = BTRC_MAX_APP_SETTINGS; } for (xx = 0; xx < app_settings.num_attr; xx++) { app_settings.attr_ids[xx] = p_rsp->p_vals[xx].attr_id; app_settings.attr_values[xx] = p_rsp->p_vals[xx].attr_val; Loading system/osi/src/config.cc +12 −2 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ ******************************************************************************/ #include "osi/include/config.h" #include "log/log.h" #include <base/files/file_path.h> #include <base/logging.h> Loading Loading @@ -170,14 +171,23 @@ void config_set_string(config_t* config, const std::string& section, sec = std::prev(config->sections.end()); } std::string value_no_newline; size_t newline_position = value.find("\n"); if (newline_position != std::string::npos) { android_errorWriteLog(0x534e4554, "70808273"); value_no_newline = value.substr(0, newline_position); } else { value_no_newline = value; } for (entry_t& entry : sec->entries) { if (entry.key == key) { entry.value = value; entry.value = value_no_newline; return; } } sec->entries.emplace_back(entry_t{.key = key, .value = value}); sec->entries.emplace_back(entry_t{.key = key, .value = value_no_newline}); } bool config_remove_section(config_t* config, const std::string& section) { Loading system/profile/avrcp/tests/avrcp_connection_handler_test.cc +1 −1 Original line number Diff line number Diff line Loading @@ -133,7 +133,7 @@ TEST_F(AvrcpConnectionHandlerTest, notConnectedDisconnectTest) { ConnectionHandler::CleanUp(); }; // Check that disconnecting without an active connection // Test calling the connection callback after the handler is cleaned up TEST_F(AvrcpConnectionHandlerTest, disconnectAfterCleanupTest) { // Set an Expectation that Open will be called twice as an acceptor and save // the connection callback once it is called. Loading system/stack/avct/avct_bcb_act.cc +15 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ * *****************************************************************************/ #include <log/log.h> #include <string.h> #include "avct_api.h" #include "avct_int.h" Loading Loading @@ -68,6 +69,12 @@ static BT_HDR* avct_bcb_msg_asmbl(UNUSED_ATTR tAVCT_BCB* p_bcb, BT_HDR* p_buf) { uint8_t* p; uint8_t pkt_type; if (p_buf->len == 0) { osi_free_and_reset((void**)&p_buf); android_errorWriteLog(0x534e4554, "79944113"); return nullptr; } /* parse the message header */ p = (uint8_t*)(p_buf + 1) + p_buf->offset; pkt_type = AVCT_PKT_TYPE(p); Loading Loading @@ -520,6 +527,14 @@ void avct_bcb_msg_ind(tAVCT_BCB* p_bcb, tAVCT_LCB_EVT* p_data) { return; } if (p_data->p_buf->len < AVCT_HDR_LEN_SINGLE) { AVCT_TRACE_WARNING("Invalid AVCTP packet length %d: must be at least %d", p_data->p_buf->len, AVCT_HDR_LEN_SINGLE); osi_free_and_reset((void**)&p_data->p_buf); android_errorWriteLog(0x534e4554, "79944113"); return; } p = (uint8_t*)(p_data->p_buf + 1) + p_data->p_buf->offset; /* parse header byte */ Loading Loading
system/bta/pan/bta_pan_act.cc +18 −27 Original line number Diff line number Diff line Loading @@ -171,28 +171,25 @@ static void bta_pan_data_flow_cb(uint16_t handle, tPAN_RESULT result) { static void bta_pan_data_buf_ind_cback(uint16_t handle, const RawAddress& src, const RawAddress& dst, uint16_t protocol, BT_HDR* p_buf, bool ext, bool forward) { tBTA_PAN_SCB* p_scb; BT_HDR* p_new_buf; tBTA_PAN_SCB* p_scb = bta_pan_scb_by_handle(handle); if (p_scb == NULL) { return; } if (sizeof(tBTA_PAN_DATA_PARAMS) > p_buf->offset) { /* offset smaller than data structure in front of actual data */ if (sizeof(BT_HDR) + sizeof(tBTA_PAN_DATA_PARAMS) + p_buf->len > PAN_BUF_SIZE) { android_errorWriteLog(0x534e4554, "63146237"); APPL_TRACE_ERROR("%s: received buffer length too large: %d", __func__, p_buf->len); osi_free(p_buf); return; } p_new_buf = (BT_HDR*)osi_malloc(PAN_BUF_SIZE); BT_HDR* p_new_buf = (BT_HDR*)osi_malloc(PAN_BUF_SIZE); memcpy((uint8_t*)(p_new_buf + 1) + sizeof(tBTA_PAN_DATA_PARAMS), (uint8_t*)(p_buf + 1) + p_buf->offset, p_buf->len); p_new_buf->len = p_buf->len; p_new_buf->offset = sizeof(tBTA_PAN_DATA_PARAMS); osi_free(p_buf); } else { p_new_buf = p_buf; } /* copy params into the space before the data */ ((tBTA_PAN_DATA_PARAMS*)p_new_buf)->src = src; ((tBTA_PAN_DATA_PARAMS*)p_new_buf)->dst = dst; Loading @@ -200,12 +197,6 @@ static void bta_pan_data_buf_ind_cback(uint16_t handle, const RawAddress& src, ((tBTA_PAN_DATA_PARAMS*)p_new_buf)->ext = ext; ((tBTA_PAN_DATA_PARAMS*)p_new_buf)->forward = forward; p_scb = bta_pan_scb_by_handle(handle); if (p_scb == NULL) { osi_free(p_new_buf); return; } fixed_queue_enqueue(p_scb->data_queue, p_new_buf); BT_HDR* p_event = (BT_HDR*)osi_malloc(sizeof(BT_HDR)); p_event->layer_specific = handle; Loading
system/btif/src/btif_rc.cc +7 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ #include "btif_util.h" #include "btu.h" #include "device/include/interop.h" #include "log/log.h" #include "osi/include/list.h" #include "osi/include/osi.h" #include "osi/include/properties.h" Loading Loading @@ -3539,6 +3540,12 @@ static void handle_app_cur_val_response(tBTA_AV_META_MSG* pmeta_msg, app_settings.num_attr = p_rsp->num_val; if (app_settings.num_attr > BTRC_MAX_APP_SETTINGS) { android_errorWriteLog(0x534e4554, "73824150"); app_settings.num_attr = BTRC_MAX_APP_SETTINGS; } for (xx = 0; xx < app_settings.num_attr; xx++) { app_settings.attr_ids[xx] = p_rsp->p_vals[xx].attr_id; app_settings.attr_values[xx] = p_rsp->p_vals[xx].attr_val; Loading
system/osi/src/config.cc +12 −2 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ ******************************************************************************/ #include "osi/include/config.h" #include "log/log.h" #include <base/files/file_path.h> #include <base/logging.h> Loading Loading @@ -170,14 +171,23 @@ void config_set_string(config_t* config, const std::string& section, sec = std::prev(config->sections.end()); } std::string value_no_newline; size_t newline_position = value.find("\n"); if (newline_position != std::string::npos) { android_errorWriteLog(0x534e4554, "70808273"); value_no_newline = value.substr(0, newline_position); } else { value_no_newline = value; } for (entry_t& entry : sec->entries) { if (entry.key == key) { entry.value = value; entry.value = value_no_newline; return; } } sec->entries.emplace_back(entry_t{.key = key, .value = value}); sec->entries.emplace_back(entry_t{.key = key, .value = value_no_newline}); } bool config_remove_section(config_t* config, const std::string& section) { Loading
system/profile/avrcp/tests/avrcp_connection_handler_test.cc +1 −1 Original line number Diff line number Diff line Loading @@ -133,7 +133,7 @@ TEST_F(AvrcpConnectionHandlerTest, notConnectedDisconnectTest) { ConnectionHandler::CleanUp(); }; // Check that disconnecting without an active connection // Test calling the connection callback after the handler is cleaned up TEST_F(AvrcpConnectionHandlerTest, disconnectAfterCleanupTest) { // Set an Expectation that Open will be called twice as an acceptor and save // the connection callback once it is called. Loading
system/stack/avct/avct_bcb_act.cc +15 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ * *****************************************************************************/ #include <log/log.h> #include <string.h> #include "avct_api.h" #include "avct_int.h" Loading Loading @@ -68,6 +69,12 @@ static BT_HDR* avct_bcb_msg_asmbl(UNUSED_ATTR tAVCT_BCB* p_bcb, BT_HDR* p_buf) { uint8_t* p; uint8_t pkt_type; if (p_buf->len == 0) { osi_free_and_reset((void**)&p_buf); android_errorWriteLog(0x534e4554, "79944113"); return nullptr; } /* parse the message header */ p = (uint8_t*)(p_buf + 1) + p_buf->offset; pkt_type = AVCT_PKT_TYPE(p); Loading Loading @@ -520,6 +527,14 @@ void avct_bcb_msg_ind(tAVCT_BCB* p_bcb, tAVCT_LCB_EVT* p_data) { return; } if (p_data->p_buf->len < AVCT_HDR_LEN_SINGLE) { AVCT_TRACE_WARNING("Invalid AVCTP packet length %d: must be at least %d", p_data->p_buf->len, AVCT_HDR_LEN_SINGLE); osi_free_and_reset((void**)&p_data->p_buf); android_errorWriteLog(0x534e4554, "79944113"); return; } p = (uint8_t*)(p_data->p_buf + 1) + p_data->p_buf->offset; /* parse header byte */ Loading