#321 ✓resolved
persmule

The reply of DLMessageGetFreeDiskSpace may be an overflowed value when idevicebackup2.

Reported by persmule | March 12th, 2013 @ 02:18 PM | in 1.2.0 Release

I found the codes to generate the reply for DLMessageGetFreeDiskSpace within idevicebackup2.c may cause problem:

uint64_t freespace = 0;
...
uint64_t freespace = fs.f_bavail * fs.f_bsize;

On some 32-bit platforms, which lacks __USE_FILE_OFFSET64, statvfs::f_bavail and statvfs::f_bsize may be both 32-bit wide, which may cause compiler to use 32-bit version of multiplication, and give a 32-bit, usually overflowed product. On these platforms, including cygwin, idevicebackup2 may reply an value suggesting that free disk space be exhausted, and refuse proceeding backup, even if the true free disk space is far from being used up.

I used this trick to fix the problem:

uint64_t freespace = 0;
...
uint64_t freespace = (uint64_t)1 * fs.f_bavail * fs.f_bsize;
as the attached diff.

Comments and changes to this ticket

  • Martin S.

    Martin S. March 18th, 2013 @ 03:56 PM

    • State changed from “new” to “resolved”
    • Tag set to idevicebackup2, overflow
    • Assigned user set to “Martin S.”
    • Milestone set to 1.2.0 Release

    Thanks, fixed in git master.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

A project around supporting the iPhone in Linux.

See http://libimobiledevice.org

People watching this ticket

Attachments

Referenced by

Pages