Commit 77901336 authored by DailyShana's avatar DailyShana

tweak

parent c3a22db3
...@@ -159,7 +159,10 @@ bool Replay::OpenReplay(const wchar_t* name) { ...@@ -159,7 +159,10 @@ bool Replay::OpenReplay(const wchar_t* name) {
} }
if(!fp) if(!fp)
return false; return false;
fread(&pheader, sizeof(pheader), 1, fp); if(fread(&pheader, sizeof(pheader), 1, fp) < 1) {
fclose(fp);
return false;
}
if(pheader.flag & REPLAY_COMPRESSED) { if(pheader.flag & REPLAY_COMPRESSED) {
comp_size = fread(comp_data, 1, 0x1000, fp); comp_size = fread(comp_data, 1, 0x1000, fp);
fclose(fp); fclose(fp);
...@@ -188,9 +191,9 @@ bool Replay::CheckReplay(const wchar_t* name) { ...@@ -188,9 +191,9 @@ bool Replay::CheckReplay(const wchar_t* name) {
if(!rfp) if(!rfp)
return false; return false;
ReplayHeader rheader; ReplayHeader rheader;
fread(&rheader, sizeof(ReplayHeader), 1, rfp); size_t count = fread(&rheader, sizeof(ReplayHeader), 1, rfp);
fclose(rfp); fclose(rfp);
return rheader.id == 0x31707279 && rheader.version >= 0x12d0; return count == 1 && rheader.id == 0x31707279 && rheader.version >= 0x12d0;
} }
bool Replay::DeleteReplay(const wchar_t* name) { bool Replay::DeleteReplay(const wchar_t* name) {
wchar_t fname[256]; wchar_t fname[256];
......
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