Merge "audio_hw: make mixer_path obey limits of MIXER_PATH_MAX_LENGTH"

This commit is contained in:
qctecmdr 2019-05-07 03:40:01 -07:00 committed by Gerrit - the friendly Code Review server
commit a57ced5e49
1 changed files with 8 additions and 2 deletions

View File

@ -1077,7 +1077,10 @@ int enable_audio_route(struct audio_device *adev,
}
audio_extn_set_custom_mtmx_params(adev, usecase, true);
strlcpy(mixer_path, use_case_table[usecase->id], MIXER_PATH_MAX_LENGTH);
// we shouldn't truncate mixer_path
ALOGW_IF(strlcpy(mixer_path, use_case_table[usecase->id], sizeof(mixer_path))
>= sizeof(mixer_path), "%s: truncation on mixer path", __func__);
// this also appends to mixer_path
platform_add_backend_name(mixer_path, snd_device, usecase);
ALOGD("%s: apply mixer and update path: %s", __func__, mixer_path);
ret = audio_route_apply_and_update_path(adev->audio_route, mixer_path);
@ -1106,7 +1109,10 @@ int disable_audio_route(struct audio_device *adev,
snd_device = usecase->in_snd_device;
else
snd_device = usecase->out_snd_device;
strlcpy(mixer_path, use_case_table[usecase->id], MIXER_PATH_MAX_LENGTH);
// we shouldn't truncate mixer_path
ALOGW_IF(strlcpy(mixer_path, use_case_table[usecase->id], sizeof(mixer_path))
>= sizeof(mixer_path), "%s: truncation on mixer path", __func__);
// this also appends to mixer_path
platform_add_backend_name(mixer_path, snd_device, usecase);
ALOGD("%s: reset and update mixer path: %s", __func__, mixer_path);
audio_route_reset_and_update_path(adev->audio_route, mixer_path);