From c54537a6639bc9ea495fac5e9ecb3ee7a699b484 Mon Sep 17 00:00:00 2001 From: Thomas Jarosch Date: Sat, 20 Dec 2014 13:37:40 +0100 Subject: Prevent theoretical out-of-bounds access in STM_Load() We should be safe since STM_Load() should never be called if STM_Test() fails. Still it's better safe than sorry. cppcheck reported: [rockbox/apps/plugins/mikmod/load_stm.c:302]: (error) Array 'STM_Version[3]' accessed at index 3, which is out of bounds. Change-Id: I914935fd108c492d013de24d17dcb9c227af6cd8 --- apps/plugins/mikmod/load_stm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/plugins/mikmod/load_stm.c b/apps/plugins/mikmod/load_stm.c index b2537ab68f..994b0e5355 100644 --- a/apps/plugins/mikmod/load_stm.c +++ b/apps/plugins/mikmod/load_stm.c @@ -299,6 +299,8 @@ static int STM_Load(int curious) /* set module variables */ for(t=0;ttrackername,STM_Signatures[t],8)) break; + if(t == STM_NTRACKERS) + return 0; of.modtype = StrDup(STM_Version[t]); of.songname = DupStr(mh->songname,20,1); /* make a cstr of songname */ of.numpat = mh->numpat; -- cgit v1.2.3