diff options
author | William Wilgus <me.theuser@yahoo.com> | 2019-10-14 21:42:19 -0500 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2020-04-17 07:30:23 +0200 |
commit | c93666d08e3ade6ee2c63d03180bac6d43536fff (patch) | |
tree | 224beaf1debd650bb8bceaeac3dcc5624fabb542 /apps/talk.c | |
parent | 4382d3f5ed1534b2f79d72cb7cf11dec9e1758c7 (diff) | |
download | rockbox-c93666d08e3ade6ee2c63d03180bac6d43536fff.tar.gz rockbox-c93666d08e3ade6ee2c63d03180bac6d43536fff.tar.bz2 rockbox-c93666d08e3ade6ee2c63d03180bac6d43536fff.zip |
talk.h make voice files check for proper number of entries on load
In addition to version and target also check id1_max & id2_max
for proper length before allowing voice file to be loaded
Change-Id: I36016059d07781b0bb43dd9873bbb6e565298d76
Diffstat (limited to 'apps/talk.c')
-rw-r--r-- | apps/talk.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/apps/talk.c b/apps/talk.c index fb16e80417..9c53bb6da5 100644 --- a/apps/talk.c +++ b/apps/talk.c @@ -613,7 +613,9 @@ static bool load_voicefile_index(int fd) if (voicefile.table == sizeof(struct voicefile_header)) { if (voicefile.version == VOICE_VERSION && - voicefile.target_id == TARGET_ID) + voicefile.target_id == TARGET_ID && + voicefile.id1_max == TALK_FINAL_ID && + voicefile.id2_max == TALK_FINAL_ID_VOICEONLY - VOICEONLY_DELIMITER) { if (load_index_table(fd, &voicefile)) return true; @@ -621,6 +623,11 @@ static bool load_voicefile_index(int fd) } logf("Incompatible voice file"); + logf("version %d expected %d", voicefile.version, VOICE_VERSION); + logf("target_id %d expected %d", voicefile.target_id, TARGET_ID); + logf("id1_max %d expected %d", voicefile.id1_max, TALK_FINAL_ID); + logf("id2_max %d expected %d", + voicefile.id2_max, TALK_FINAL_ID_VOICEONLY - VOICEONLY_DELIMITER); return false; } |