Merge changes from topic "am-83fa0073-1c66-42ef-b933-72b932ba2be3" into nyc-dr1-dev

* changes:
  [automerger] DO NOT MERGE: AVRCP: Initialize buffer for attribute values to be written to am: aeff2c709c
  DO NOT MERGE: AVRCP: Initialize buffer for attribute values to be written to
diff --git a/osi/src/config.c b/osi/src/config.c
index 345f907..9145ce6 100644
--- a/osi/src/config.c
+++ b/osi/src/config.c
@@ -34,6 +34,7 @@
 #include "osi/include/allocator.h"
 #include "osi/include/list.h"
 #include "osi/include/log.h"
+#include "log/log.h"
 
 typedef struct {
   char *key;
@@ -216,16 +217,28 @@
     list_append(config->sections, sec);
   }
 
+  size_t value_len = strlen(value);
+  char *value_no_newline = osi_strdup(value);
+  for (size_t i = 0; i < value_len; i++) {
+    if (value[i] == '\n') {
+      android_errorWriteLog(0x534e4554, "70808273");
+      value_no_newline[i] = '\0';
+      break;
+    }
+  }
+
   for (const list_node_t *node = list_begin(sec->entries); node != list_end(sec->entries); node = list_next(node)) {
     entry_t *entry = list_node(node);
     if (!strcmp(entry->key, key)) {
       osi_free(entry->value);
-      entry->value = osi_strdup(value);
+      entry->value = osi_strdup(value_no_newline);
+      osi_free(value_no_newline);
       return;
     }
   }
 
-  entry_t *entry = entry_new(key, value);
+  entry_t *entry = entry_new(key, value_no_newline);
+  osi_free(value_no_newline);
   list_append(sec->entries, entry);
 }
 
diff --git a/stack/avrc/avrc_pars_ct.c b/stack/avrc/avrc_pars_ct.c
index e841b5c..80c5c7d 100644
--- a/stack/avrc/avrc_pars_ct.c
+++ b/stack/avrc/avrc_pars_ct.c
@@ -22,6 +22,7 @@
 #include "avrc_defs.h"
 #include "avrc_int.h"
 #include "bt_utils.h"
+#include "log/log.h"
 
 /*****************************************************************************
 **  Global data
@@ -226,6 +227,12 @@
             break;
         }
         BE_STREAM_TO_UINT8(p_result->list_app_attr.num_attr, p);
+
+        if (p_result->list_app_attr.num_attr > AVRC_MAX_APP_ATTR_SIZE) {
+          android_errorWriteLog(0x534e4554, "63146237");
+          p_result->list_app_attr.num_attr = AVRC_MAX_APP_ATTR_SIZE;
+        }
+
         AVRC_TRACE_DEBUG("%s attr count = %d ", __func__, p_result->list_app_attr.num_attr);
         for(int xx = 0; xx < p_result->list_app_attr.num_attr; xx++)
         {