Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/getsize.c =================================================================== --- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/getsize.c +++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/getsize.c @@ -250,6 +250,11 @@ errcode_t ext2fs_get_device_size(const c 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; }