@@ -1158,9 +1158,11 @@ bool bt_cap_initiator_valid_unicast_audio_start_param(
1158
1158
const union bt_cap_set_member * member = & stream_param -> member ;
1159
1159
const struct bt_cap_stream * cap_stream = stream_param -> stream ;
1160
1160
const struct bt_audio_codec_cfg * codec_cfg = stream_param -> codec_cfg ;
1161
+ const struct bt_bap_ep * ep = stream_param -> ep ;
1161
1162
const struct bt_bap_stream * bap_stream ;
1162
1163
const struct bt_conn * member_conn =
1163
1164
bt_cap_common_get_member_conn (param -> type , member );
1165
+ struct bt_conn * ep_conn ;
1164
1166
1165
1167
if (member == NULL ) {
1166
1168
LOG_DBG ("param->members[%zu] is NULL" , i );
@@ -1182,11 +1184,26 @@ bool bt_cap_initiator_valid_unicast_audio_start_param(
1182
1184
return false;
1183
1185
}
1184
1186
1185
- CHECKIF ( stream_param -> ep == NULL ) {
1187
+ if ( ep == NULL ) {
1186
1188
LOG_DBG ("param->stream_params[%zu].ep is NULL" , i );
1187
1189
return false;
1188
1190
}
1189
1191
1192
+ ep_conn = bt_bap_ep_get_conn (ep );
1193
+ if (ep_conn == NULL ) {
1194
+ LOG_DBG ("param->stream_params[%zu].ep is invalid" , i );
1195
+ return false;
1196
+ }
1197
+ if (ep_conn != member_conn ) {
1198
+ LOG_DBG ("param->stream_params[%zu].ep conn %p does not match "
1199
+ "param->members[%zu] %p" ,
1200
+ i , ep_conn , i , member_conn );
1201
+ bt_conn_unref (ep_conn );
1202
+
1203
+ return false;
1204
+ }
1205
+ bt_conn_unref (ep_conn );
1206
+
1190
1207
CHECKIF (member == NULL ) {
1191
1208
LOG_DBG ("param->stream_params[%zu].member is NULL" , i );
1192
1209
return false;
0 commit comments