mirror of
https://github.com/d0k3/GodMode9.git
synced 2025-06-26 13:42:47 +00:00
Fix: Unaligned file lengths in virtual TADs
Thanks @zoogie for pointing that one out.
This commit is contained in:
parent
c18ac35d45
commit
75791f1908
@ -121,7 +121,9 @@ FRESULT fx_decrypt_dsiware (FIL* fp, void* buff, FSIZE_t ofs, UINT len) {
|
|||||||
// decrypt last block
|
// decrypt last block
|
||||||
if (data_pos < data_end) {
|
if (data_pos < data_end) {
|
||||||
u8* lbuff = (u8*) buff + (data_pos - ofs);
|
u8* lbuff = (u8*) buff + (data_pos - ofs);
|
||||||
memcpy(block, lbuff, data_end - data_pos);
|
// memcpy(block, lbuff, data_end - data_pos); // <--- this should work, but it doesn't
|
||||||
|
if ((res = f_lseek(fp, data_pos)) != FR_OK) return res;
|
||||||
|
if ((res = f_read(fp, block, AES_BLOCK_SIZE, &br)) != FR_OK) return res;
|
||||||
cbc_decrypt(block, block, 1, mode, iv);
|
cbc_decrypt(block, block, 1, mode, iv);
|
||||||
memcpy(lbuff, block, data_end - data_pos);
|
memcpy(lbuff, block, data_end - data_pos);
|
||||||
data_pos = data_end;
|
data_pos = data_end;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user