Skip to content

Commit

Permalink
fat: Fix stack corruption on 64 bit due to wrong count type.
Browse files Browse the repository at this point in the history
On 64 bit platforms a 64 bit size_t was written at the (incorrect)
uint32 on the stack, causing the adjacent bytes variable to be
clobbered. Because of this, the vectors wouldn't actually be filled
with any file data, making the content of files inacessible.
  • Loading branch information
mmlr committed May 2, 2015
1 parent 110eea4 commit 09592b1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/add-ons/kernel/file_systems/fat/file.c
Expand Up @@ -1439,7 +1439,7 @@ dosfs_read_pages(fs_volume *_vol, fs_vnode *_node, void *_cookie, off_t pos,

while (true) {
struct file_io_vec fileVecs[8];
uint32 fileVecCount = 8;
size_t fileVecCount = 8;
bool bufferOverflow;
size_t bytes = bytesLeft;

Expand Down Expand Up @@ -1483,7 +1483,7 @@ dosfs_write_pages(fs_volume *_vol, fs_vnode *_node, void *_cookie, off_t pos,

while (true) {
struct file_io_vec fileVecs[8];
uint32 fileVecCount = 8;
size_t fileVecCount = 8;
bool bufferOverflow;
size_t bytes = bytesLeft;

Expand Down

0 comments on commit 09592b1

Please sign in to comment.