sound trigger: fix array overflow in HAL wrapper
Bug: 65383689 Test: make Change-Id: I9d62eb9be096222bcc3e1734a21f6ade0005b180
This commit is contained in:
parent
1a17e86d76
commit
a6920307f1
1 changed files with 4 additions and 2 deletions
|
@ -388,10 +388,12 @@ void SoundTriggerHalImpl::convertTriggerPhraseToHal(
|
||||||
halTriggerPhrase->id = triggerPhrase->id;
|
halTriggerPhrase->id = triggerPhrase->id;
|
||||||
halTriggerPhrase->recognition_mode = triggerPhrase->recognitionModes;
|
halTriggerPhrase->recognition_mode = triggerPhrase->recognitionModes;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
for (i = 0; i < triggerPhrase->users.size(); i++) {
|
|
||||||
|
halTriggerPhrase->num_users =
|
||||||
|
std::min((int)triggerPhrase->users.size(), SOUND_TRIGGER_MAX_USERS);
|
||||||
|
for (i = 0; i < halTriggerPhrase->num_users; i++) {
|
||||||
halTriggerPhrase->users[i] = triggerPhrase->users[i];
|
halTriggerPhrase->users[i] = triggerPhrase->users[i];
|
||||||
}
|
}
|
||||||
halTriggerPhrase->num_users = i;
|
|
||||||
|
|
||||||
strlcpy(halTriggerPhrase->locale,
|
strlcpy(halTriggerPhrase->locale,
|
||||||
triggerPhrase->locale.c_str(), SOUND_TRIGGER_MAX_LOCALE_LEN);
|
triggerPhrase->locale.c_str(), SOUND_TRIGGER_MAX_LOCALE_LEN);
|
||||||
|
|
Loading…
Reference in a new issue