Check for potential overflow for filesystems contained in regular files
where the filesystem image size is returned by stat64().
Signed-off-by: Eric Sandeen <esandeen@sandeen.net>
+2006-10-02 Eric Sandeen <esandeen@sandeen.net>
+
+ * getsize.c (ext2fs_get_device_size): Check to make sure that the
+ number of blocks doesn't overflow the retblocks return
+ parameter for regular files using stat64().
+
2006-10-01 Theodore Tso <tytso@mit.edu>
* bitops.h (ext2fs_swab32): Only include ext2fs_swab32() if
if (fstat(fd, &st) == 0)
#endif
if (S_ISREG(st.st_mode)) {
+ if ((sizeof(*retblocks) < sizeof(unsigned long long)) &&
+ ((st.st_size / blocksize) > 0xFFFFFFFF)) {
+ rc = EFBIG;
+ goto out;
+ }
*retblocks = st.st_size / blocksize;
goto out;
}