Ensure comment strings in CBannerLoaderWii::SWiiBanner are null-terminated. Fixes issue 5012.

Signed-off-by: Shawn Hoffman <godisgovernment@gmail.com>
This commit is contained in:
Shawn Hoffman
2011-11-27 23:17:10 -08:00
parent 79ca43226c
commit bef3d7229e
2 changed files with 60 additions and 60 deletions

View File

@ -47,9 +47,18 @@ class CBannerLoaderWii
private:
#define WII_BANNER_TEXTURE_SIZE (192 * 64 * 2)
#define WII_BANNER_ICON_SIZE ( 48 * 48 * 2)
#define WII_BANNER_COMMENT_SIZE 32
enum
{
TEXTURE_SIZE = 192 * 64 * 2,
ICON_SIZE = 48 * 48 * 2,
COMMENT_SIZE = 32
};
enum CommentIndex
{
NAME_IDX,
DESC_IDX
};
struct SWiiBanner
{
@ -59,9 +68,10 @@ class CBannerLoaderWii
u16 m_Speed;
u8 m_Unknown[22];
u16 m_Comment[2][WII_BANNER_COMMENT_SIZE];
u8 m_BannerTexture[WII_BANNER_TEXTURE_SIZE];
u8 m_IconTexture[8][WII_BANNER_ICON_SIZE];
// Not null terminated!
u16 m_Comment[2][COMMENT_SIZE];
u8 m_BannerTexture[TEXTURE_SIZE];
u8 m_IconTexture[8][ICON_SIZE];
} ;
u8* m_pBannerFile;
@ -69,6 +79,9 @@ class CBannerLoaderWii
bool m_IsValid;
void decode5A3image(u32* dst, u16* src, int width, int height);
bool GetStringFromComments(const CommentIndex index, std::string& s);
bool GetStringFromComments(const CommentIndex index, std::wstring& s);
};
} // namespace