mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-11 00:29:11 +01:00
Fix potential buffer overflow in OSD
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2336 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
fe0be64bd3
commit
b211200460
@ -29,7 +29,11 @@ namespace OSD
|
|||||||
struct MESSAGE
|
struct MESSAGE
|
||||||
{
|
{
|
||||||
MESSAGE() {}
|
MESSAGE() {}
|
||||||
MESSAGE(const char* p, u32 dw) { strcpy(str, p); dwTimeStamp = dw; }
|
MESSAGE(const char* p, u32 dw) {
|
||||||
|
strncpy(str, p, 255);
|
||||||
|
str[255] = '\0';
|
||||||
|
dwTimeStamp = dw;
|
||||||
|
}
|
||||||
char str[255];
|
char str[255];
|
||||||
u32 dwTimeStamp;
|
u32 dwTimeStamp;
|
||||||
};
|
};
|
||||||
@ -47,7 +51,8 @@ void DrawMessages()
|
|||||||
if (!wasEnabled)
|
if (!wasEnabled)
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
|
|
||||||
if (s_listMsgs.size() > 0) {
|
if (s_listMsgs.size() > 0)
|
||||||
|
{
|
||||||
int left = 25, top = 15;
|
int left = 25, top = 15;
|
||||||
std::list<MESSAGE>::iterator it = s_listMsgs.begin();
|
std::list<MESSAGE>::iterator it = s_listMsgs.begin();
|
||||||
while (it != s_listMsgs.end())
|
while (it != s_listMsgs.end())
|
||||||
@ -74,7 +79,8 @@ void DrawMessages()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wasEnabled) glDisable(GL_BLEND);
|
if (!wasEnabled)
|
||||||
|
glDisable(GL_BLEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
Loading…
x
Reference in New Issue
Block a user