Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

firejail --ls reports wrong file sizes for large files #5982

Closed
reinerh opened this issue Aug 28, 2023 · 0 comments · Fixed by #6086
Closed

firejail --ls reports wrong file sizes for large files #5982

reinerh opened this issue Aug 28, 2023 · 0 comments · Fixed by #6086
Labels
bug Something isn't working

Comments

@reinerh
Copy link
Collaborator

reinerh commented Aug 28, 2023

I noticed that the --ls command prints negative file sizes for large files (the file has a size of several GB).

$ firejail --ls=... /
...
-rw------- root     root      -214748364 swap.bin
...

The problem seems to be that it's using a (32bit) int, while st_size is actually of type off_t (which is on x86_64 a long int).

firejail/src/firejail/ls.c

Lines 155 to 158 in dd5ae0d

// file size
char *sz;
if (asprintf(&sz, "%d", (int) s.st_size) == -1)
errExit("asprintf");

@reinerh reinerh added the bug Something isn't working label Aug 28, 2023
chestnykh added a commit to chestnykh/firejail that referenced this issue Nov 13, 2023
The most generic way is to use `intmax_t`
because we dont't know what is the "parent" type of `off_t`.
This fixes netblue30#5982 .
kmk3 pushed a commit that referenced this issue Nov 24, 2023
The most generic way is to use `intmax_t`
because we dont't know what is the "parent" type of `off_t`.
This fixes #5982 .
@github-project-automation github-project-automation bot moved this to Done (on RELNOTES) in Release 0.9.74 Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done (on RELNOTES)
Development

Successfully merging a pull request may close this issue.

1 participant