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:
parent
f8d9e9cb6c
commit
c54537a663
1 changed files with 2 additions and 0 deletions
|
@ -299,6 +299,8 @@ static int STM_Load(int curious)
|
||||||
/* set module variables */
|
/* set module variables */
|
||||||
for(t=0;t<STM_NTRACKERS;t++)
|
for(t=0;t<STM_NTRACKERS;t++)
|
||||||
if(!memcmp(mh->trackername,STM_Signatures[t],8)) break;
|
if(!memcmp(mh->trackername,STM_Signatures[t],8)) break;
|
||||||
|
if(t == STM_NTRACKERS)
|
||||||
|
return 0;
|
||||||
of.modtype = StrDup(STM_Version[t]);
|
of.modtype = StrDup(STM_Version[t]);
|
||||||
of.songname = DupStr(mh->songname,20,1); /* make a cstr of songname */
|
of.songname = DupStr(mh->songname,20,1); /* make a cstr of songname */
|
||||||
of.numpat = mh->numpat;
|
of.numpat = mh->numpat;
|
||||||
|
|
Loading…
Reference in a new issue