Cast fstat values to i64 to prevent 32 bit overflows.

This commit is contained in:
Con Kolivas 2011-03-14 10:21:10 +11:00
parent e138fa77ff
commit 19ef7298c8
2 changed files with 2 additions and 2 deletions

View file

@ -467,7 +467,7 @@ void decompress_file(rzip_control *control)
* decompressed file. */
if (unlikely(fstatvfs(fd_out, &fbuf)))
fatal("Failed to fstatvfs in decompress_file\n");
free_space = fbuf.f_bsize * fbuf.f_bavail;
free_space = (i64)fbuf.f_bsize * (i64)fbuf.f_bavail;
if (free_space < expected_size) {
if (FORCE_REPLACE)
print_err("Warning, inadequate free space detected, but attempting to decompress due to -f option being used.\n");

2
rzip.c
View file

@ -795,7 +795,7 @@ void rzip_fd(rzip_control *control, int fd_in, int fd_out)
* uncompressed file. */
if (unlikely(fstatvfs(fd_out, &fbuf)))
fatal("Failed to fstatvfs in compress_file\n");
free_space = fbuf.f_bsize * fbuf.f_bavail;
free_space = (i64)fbuf.f_bsize * (i64)fbuf.f_bavail;
if (free_space < control->st_size) {
if (FORCE_REPLACE)
print_err("Warning, possibly inadequate free space detected, but attempting to compress due to -f option being used.\n");