Commit 5c6ada99 authored by Chen Bill's avatar Chen Bill

check sizeof deckBuffer in LoadDeck

parent 44657e35
...@@ -280,8 +280,8 @@ bool DeckManager::LoadDeck(const wchar_t* file, bool is_packlist) { ...@@ -280,8 +280,8 @@ bool DeckManager::LoadDeck(const wchar_t* file, bool is_packlist) {
} }
if(!reader) if(!reader)
return false; return false;
size_t size = reader->getSize(); auto size = reader->getSize();
if(size >= 0x20000) { if(size >= (int)sizeof deckBuffer) {
reader->drop(); reader->drop();
return false; return false;
} }
...@@ -296,7 +296,7 @@ bool DeckManager::LoadDeck(std::istringstream* deckStream, bool is_packlist) { ...@@ -296,7 +296,7 @@ bool DeckManager::LoadDeck(std::istringstream* deckStream, bool is_packlist) {
int cardlist[300]; int cardlist[300];
bool is_side = false; bool is_side = false;
std::string linebuf; std::string linebuf;
while(std::getline(*deckStream, linebuf) && ct < 300) { while(std::getline(*deckStream, linebuf, '\n') && ct < 300) {
if(linebuf[0] == '!') { if(linebuf[0] == '!') {
is_side = true; is_side = true;
continue; continue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment