Skip to content

memcpy out of bounds #1

Description

@983

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.

SSFS/ssfs.c

Line 91 in 5bc24f8

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions