diff options
author | Arisotura <thetotalworm@gmail.com> | 2020-08-19 19:16:09 +0200 |
---|---|---|
committer | Arisotura <thetotalworm@gmail.com> | 2020-08-19 19:16:09 +0200 |
commit | 660792d64ba2a1bab5187270a892d05ba1133dce (patch) | |
tree | ccf580b59d29844cb4c2275f5cb8d50c9c5572bd /src | |
parent | c9447935ffccce531d556cc0a572b020e07ba987 (diff) |
wifi:
* don't receive packets if the RX buffer is zero-sized
* avoid potential out-of-bound writes
Diffstat (limited to 'src')
-rw-r--r-- | src/Wifi.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Wifi.cpp b/src/Wifi.cpp index 8188151..8a06041 100644 --- a/src/Wifi.cpp +++ b/src/Wifi.cpp @@ -816,6 +816,9 @@ bool CheckRX(bool block) if (!(IOPORT(W_RXCnt) & 0x8000)) return false; + if (IOPORT(W_RXBufBegin) == IOPORT(W_RXBufEnd)) + return false; + u16 framelen; u16 framectl; u8 txrate; @@ -1049,7 +1052,7 @@ void USTimer(u32 param) if (!(RXTime & RXHalfwordTimeMask)) { u16 addr = IOPORT(W_RXTXAddr) << 1; - *(u16*)&RAM[addr] = *(u16*)&RXBuffer[RXBufferPtr]; + if (addr < 0x1FFF) *(u16*)&RAM[addr] = *(u16*)&RXBuffer[RXBufferPtr]; IncrementRXAddr(addr); RXBufferPtr += 2; @@ -1146,7 +1149,7 @@ void RFTransfer_Type3() // TODO: wifi waitstates u16 Read(u32 addr) -{ +{//printf("WIFI READ %08X\n", addr); if (addr >= 0x04810000) return 0; @@ -1236,7 +1239,7 @@ u16 Read(u32 addr) } void Write(u32 addr, u16 val) -{ +{//printf("WIFI WRITE %08X %04X\n", addr, val); if (addr >= 0x04810000) return; |