-added back banner security checks for regular game banners, only

cached/custom banners wont be checked
This commit is contained in:
fix94.1 2012-07-04 23:31:38 +00:00
parent 87c10f744c
commit 1ce0749a7f
3 changed files with 6 additions and 13 deletions

View File

@ -42,7 +42,7 @@
#define IMET_OFFSET 0x40 #define IMET_OFFSET 0x40
#define IMET_SIGNATURE 0x494d4554 #define IMET_SIGNATURE 0x494d4554
Banner::Banner(u8 *bnr, u32 bnr_size, u64 title) Banner::Banner(u8 *bnr, u32 bnr_size, u64 title, bool custom)
{ {
this->title = title; this->title = title;
opening = bnr; opening = bnr;
@ -53,13 +53,10 @@ Banner::Banner(u8 *bnr, u32 bnr_size, u64 title)
IMET *imet = (IMET *) opening; IMET *imet = (IMET *) opening;
if (imet->sig != IMET_SIGNATURE) if (imet->sig != IMET_SIGNATURE)
{
imet = (IMET *) (opening + IMET_OFFSET); imet = (IMET *) (opening + IMET_OFFSET);
}
if (imet->sig == IMET_SIGNATURE) if(imet->sig == IMET_SIGNATURE)
{ {
/*
unsigned char md5[16]; unsigned char md5[16];
unsigned char imetmd5[16]; unsigned char imetmd5[16];
@ -67,14 +64,10 @@ Banner::Banner(u8 *bnr, u32 bnr_size, u64 title)
memset(imet->md5, 0, 16); memset(imet->md5, 0, 16);
MD5(md5, (unsigned char*)(imet), sizeof(IMET)); MD5(md5, (unsigned char*)(imet), sizeof(IMET));
if (memcmp(imetmd5, md5, 16) == 0) if(memcmp(imetmd5, md5, 16) == 0 || custom)
{*/
this->imet = imet; this->imet = imet;
/*}
else else
{
gprintf("Invalid md5, banner not valid for title %08x\n", title); gprintf("Invalid md5, banner not valid for title %08x\n", title);
}*/
} }
else else
{ {

View File

@ -60,7 +60,7 @@ typedef struct
class Banner class Banner
{ {
public: public:
Banner(u8 *bnr, u32 bnr_size, u64 title = 0); Banner(u8 *bnr, u32 bnr_size, u64 title = 0, bool custom = false);
~Banner(); ~Banner();
bool IsValid(); bool IsValid();

View File

@ -1551,7 +1551,7 @@ void CMenu::_gameSoundThread(CMenu *m)
m->m_gamesound_changed = false; m->m_gamesound_changed = false;
u32 sndSize = 0; u32 sndSize = 0;
Banner *banner = custom_bnr_file != NULL ? new Banner((u8 *)custom_bnr_file, custom_bnr_size) : Banner *banner = custom_bnr_file != NULL ? new Banner((u8 *)custom_bnr_file, custom_bnr_size, 0, true) :
(m->m_gameSoundHdr->type == TYPE_WII_GAME ? _extractBnr(m->m_gameSoundHdr) : (m->m_gameSoundHdr->type == TYPE_CHANNEL ? (m->m_gameSoundHdr->type == TYPE_WII_GAME ? _extractBnr(m->m_gameSoundHdr) : (m->m_gameSoundHdr->type == TYPE_CHANNEL ?
_extractChannelBnr(TITLE_ID(m->m_gameSoundHdr->settings[0],m->m_gameSoundHdr->settings[1])) : NULL)); _extractChannelBnr(TITLE_ID(m->m_gameSoundHdr->settings[0],m->m_gameSoundHdr->settings[1])) : NULL));
m->m_gameSoundHdr = NULL; m->m_gameSoundHdr = NULL;