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
This commit is contained in:
Thomas Jarosch 2014-12-20 13:37:40 +01:00
parent f8d9e9cb6c
commit c54537a663

View file

@ -299,6 +299,8 @@ static int STM_Load(int curious)
/* set module variables */
for(t=0;t<STM_NTRACKERS;t++)
if(!memcmp(mh->trackername,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;