Skip to content

Commit

Permalink
kernel/vfs: Don't allow reads/writes past the end of :ofbXX
Browse files Browse the repository at this point in the history
  • Loading branch information
ry755 committed Oct 18, 2024
1 parent 8738047 commit e0f6f81
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions kernel/vfs/ofb.asm
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ open_stream_ofb:
in r0, r0
mov r1, r0
srl r1, 16
and r1, 0x0000FFFF
and r0, 0x0000FFFF
mul r1, r0
mul r1, 4
mov [r2], r1 ; write file_size
add r2, 4
mov [r2], 0 ; write file_reserved_3
Expand Down Expand Up @@ -76,7 +77,7 @@ ofb_stream_read:
srl r0, 16
and r1, 0x0000FFFF
mul r1, r0
mul r0, 4
mul r1, 4
pop r0

; ensure the seek offset is less than the overlay size
Expand Down

0 comments on commit e0f6f81

Please sign in to comment.