Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c86198a6 authored by Ajay Panicker's avatar Ajay Panicker Committed by Myles Watson
Browse files

AVRCP: Initialize buffer for attribute values to be written to

Test: Build
Bug: 71603553
Change-Id: I978270605cfaa3b833d6c19f1b1d2cd5a82ac079
parent e11cfb8d
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
#include "avrc_int.h"
#include "bt_common.h"
#include "bt_utils.h"
#include "log/log.h"
#include "osi/include/osi.h"

/*****************************************************************************
@@ -495,7 +496,6 @@ static tAVRC_STS avrc_ctrl_pars_vendor_rsp(tAVRC_MSG_VENDOR* p_msg,
    } break;

    case AVRC_PDU_GET_PLAYER_APP_ATTR_TEXT: {
      tAVRC_APP_SETTING_TEXT* p_setting_text;
      uint8_t num_attrs;

      if (len == 0) {
@@ -503,10 +503,14 @@ static tAVRC_STS avrc_ctrl_pars_vendor_rsp(tAVRC_MSG_VENDOR* p_msg,
        break;
      }
      BE_STREAM_TO_UINT8(num_attrs, p);
      if (num_attrs > AVRC_MAX_APP_ATTR_SIZE) {
        num_attrs = AVRC_MAX_APP_ATTR_SIZE;
      }
      AVRC_TRACE_DEBUG("%s attr count = %d ", __func__,
                       p_result->get_app_attr_txt.num_attr);
      p_result->get_app_attr_txt.num_attr = num_attrs;
      p_setting_text = (tAVRC_APP_SETTING_TEXT*)osi_malloc(

      p_result->get_app_attr_txt.p_attrs = (tAVRC_APP_SETTING_TEXT*)osi_malloc(
          num_attrs * sizeof(tAVRC_APP_SETTING_TEXT));
      for (int xx = 0; xx < num_attrs; xx++) {
        BE_STREAM_TO_UINT8(p_result->get_app_attr_txt.p_attrs[xx].attr_id, p);
@@ -526,7 +530,6 @@ static tAVRC_STS avrc_ctrl_pars_vendor_rsp(tAVRC_MSG_VENDOR* p_msg,
    } break;

    case AVRC_PDU_GET_PLAYER_APP_VALUE_TEXT: {
      tAVRC_APP_SETTING_TEXT* p_setting_text;
      uint8_t num_vals;

      if (len == 0) {
@@ -534,11 +537,14 @@ static tAVRC_STS avrc_ctrl_pars_vendor_rsp(tAVRC_MSG_VENDOR* p_msg,
        break;
      }
      BE_STREAM_TO_UINT8(num_vals, p);
      if (num_vals > AVRC_MAX_APP_ATTR_SIZE) {
        num_vals = AVRC_MAX_APP_ATTR_SIZE;
      }
      p_result->get_app_val_txt.num_attr = num_vals;
      AVRC_TRACE_DEBUG("%s value count = %d ", __func__,
                       p_result->get_app_val_txt.num_attr);

      p_setting_text = (tAVRC_APP_SETTING_TEXT*)osi_malloc(
      p_result->get_app_val_txt.p_attrs = (tAVRC_APP_SETTING_TEXT*)osi_malloc(
          num_vals * sizeof(tAVRC_APP_SETTING_TEXT));
      for (int i = 0; i < num_vals; i++) {
        BE_STREAM_TO_UINT8(p_result->get_app_val_txt.p_attrs[i].attr_id, p);