From c9974b65c435f98aefe0f1d048a0866b6f8592d8 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Tue, 1 Nov 2016 13:41:54 +0100 Subject: [PATCH] iop: remove kernelTTYFileDescrWrite debug function Recommended by pseudo Main issue is a buffer underflow when strlen(...) < 2 2nd issue is code is called based on hardcoded address of a single bios. --- pcsx2/IopMem.cpp | 3 --- pcsx2/ps2/pgif.cpp | 41 ----------------------------------------- 2 files changed, 44 deletions(-) diff --git a/pcsx2/IopMem.cpp b/pcsx2/IopMem.cpp index 8558cb40d3..9da0bf98a2 100644 --- a/pcsx2/IopMem.cpp +++ b/pcsx2/IopMem.cpp @@ -489,7 +489,4 @@ void __fastcall iopMemWrite32(u32 mem, u32 value) } } } - - if (mem == 0x000085CC) - kernelTTYFileDescrWrite(mem, value); } diff --git a/pcsx2/ps2/pgif.cpp b/pcsx2/ps2/pgif.cpp index f749202e5b..66712fc4d5 100644 --- a/pcsx2/ps2/pgif.cpp +++ b/pcsx2/ps2/pgif.cpp @@ -1017,47 +1017,6 @@ u8 psExp2R8(u32 mem) //int flgint = 0; -char strb[200] = {0}; -void kernelTTYFileDescrWrite(u32 mem, u32 data) -{ - //data is an address actually - char stra[100]; - int i; - // if (mem == ) { - for (i = 0; i < 100; i++) - stra[i] = iopMemRead8(data + i); - stra[99] = 0; - - //Console.WriteLn("Wr to PS1 kernel file TTY descr. data = %08X at addr %08X >%s< ", data, iopMemRead32(data), stra); - - //Console.WriteLn("%s", stra); - - - if ((strlen(strb) + strlen(stra)) >= 200) { - //Console.WriteLn("%s", strb); - strb[0] = 0; - } else { - - strcat(strb, stra); - if ((stra[strlen(stra) - 1] == 0xA) || (stra[strlen(stra) - 1] == 0xD) || (stra[strlen(stra) - 2] == 0xA) || (stra[strlen(stra) - 2] == 0xD)) { - // VSync: timeout is spammy - if (strncmp(strb, "VSync: timeout", 14) != 0) { - - Console.WriteLn("%s", strb); - /* if (strcmp(strb, "VSync") == 0) - flgint ^= 1; - if (strncmp(strb, "Execute", 5) == 0) { - Console.WriteLn(" ###EXecute was just printed####"); - doAnyIopLs = 1; - }*/ - } - strb[0] = 0; - } - } - //} -} - - //0x80051080 u32 getIntTmrKReg(u32 mem, u32 data) {