diff options
author | Jim Meyering <jim@meyering.net> | 1996-04-19 05:07:52 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1996-04-19 05:07:52 +0000 |
commit | f60c8ea48bf9e61e7443c1f4c07c630d93746f83 (patch) | |
tree | c37ce460f28438d28f41d672ebb713b912a320a7 /src | |
parent | dafd2cb4e216cffc35592761f0b71f350d4532d8 (diff) | |
download | coreutils-f60c8ea48bf9e61e7443c1f4c07c630d93746f83.tar.xz |
(copy_reg): Rearrange arithmetic in conditional to avoid
integer overflow with large files.
Diffstat (limited to 'src')
-rw-r--r-- | src/cp.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -1242,7 +1242,7 @@ copy_reg (char *src_path, char *dst_path) be needed for a file of its size, then at least one of the blocks in the file is a hole. */ /* FIXME: isn't there risk of overflow here? */ - if (S_ISREG (sb.st_mode) && sb.st_size > ST_NBLOCKS (sb) * 512) + if (S_ISREG (sb.st_mode) && sb.st_size / 512 > ST_NBLOCKS (sb)) make_holes = 1; } #endif |