Thank you for your file system tutorial, it has helped me a lot.
However, I think that the memcpy in the do_read function accesses memory which is out of bounds because size is 4096, but selectedText is much shorter.
|
memcpy( buffer, selectedText + offset, size ); |
Surprisingly, valgrind does not complain about this, so maybe I am wrong?
Anyway, it is probably a good idea to also set the correct file size in do_getattr because some programs simply check the file size and then try to read and use that many bytes, ignoring that fread might have returned a much smaller number of bytes.
Thank you for your file system tutorial, it has helped me a lot.
However, I think that the
memcpyin thedo_readfunction accesses memory which is out of bounds becausesizeis 4096, butselectedTextis much shorter.SSFS/ssfs.c
Line 91 in 5bc24f8
Surprisingly, valgrind does not complain about this, so maybe I am wrong?
Anyway, it is probably a good idea to also set the correct file size in
do_getattrbecause some programs simply check the file size and then try to read and use that many bytes, ignoring thatfreadmight have returned a much smaller number of bytes.