mirror of
https://github.com/armel/uv-k1-k5v3-firmware-custom.git
synced 2026-10-02 03:15:37 +00:00
Reject oversized EEPROM read commands (Thanks @BB-KING777)
This commit is contained in:
1 parent
88d17655de
commit
265f83a447
1 file changed
+5
-1
+5
-1
@@ -403,6 +403,10 @@ static void CMD_051B(uint32_t Port, const uint8_t *pBuffer)
|
||||
gFmRadioCountdown_500ms = fm_radio_countdown_500ms;
|
||||
#endif
|
||||
|
||||
// Reject reads that do not fit in the fixed-size reply buffer.
|
||||
if (pCmd->Size > sizeof(Reply.Data.Data))
|
||||
return;
|
||||
|
||||
memset(&Reply, 0, sizeof(Reply));
|
||||
Reply.Header.ID = 0x051C;
|
||||
Reply.Header.Size = pCmd->Size + 4;
|
||||
@@ -416,7 +420,7 @@ static void CMD_051B(uint32_t Port, const uint8_t *pBuffer)
|
||||
{
|
||||
EEPROM_ReadBuffer(pCmd->Offset, Reply.Data.Data, pCmd->Size);
|
||||
}
|
||||
|
||||
|
||||
SendReply(Port, &Reply, pCmd->Size + 8);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user