of blocks is greater than 2**32 when we are doing a binary
search to determine the device size. Thanks to Stephen
Tweedie for the patch.
+2005-03-18 Theodore Ts'o <tytso@mit.edu>
+
+ * getsize.c (ext2fs_get_device_size): Check to see if the number
+ of blocks is greater than 2**32 when we are doing a binary
+ search to determine the device size. Thanks to Stephen
+ Tweedie for the patch.
+
2006-02-05 Theodore Ts'o <tytso@mit.edu>
* Release of E2fsprogs 1.36
}
valid_offset (fd, 0);
close(fd);
- *retblocks = (low + 1) / blocksize;
+ size64 = low + 1;
+ if ((sizeof(*retblocks) < sizeof(unsigned long long))
+ && ((size64 / blocksize) > 0xFFFFFFFF))
+ return EFBIG;
+ *retblocks = size64 / blocksize;
return 0;
}