From 09592b1dccf44420e9cf8b3212dc372a6b4972eb Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sat, 2 May 2015 11:58:31 +0200 Subject: [PATCH] fat: Fix stack corruption on 64 bit due to wrong count type. 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. --- src/add-ons/kernel/file_systems/fat/file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/add-ons/kernel/file_systems/fat/file.c b/src/add-ons/kernel/file_systems/fat/file.c index e17813cb0c..aa2ed8ca6c 100644 --- a/src/add-ons/kernel/file_systems/fat/file.c +++ b/src/add-ons/kernel/file_systems/fat/file.c @@ -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; @@ -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;