https://bugzilla.samba.org/show_bug.cgi?id=10643
Summary: cmp_time() returns incorrect result due to integer overflow Product: rsync Version: 3.1.1 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P5 Component: core AssignedTo: way...@samba.org ReportedBy: william.hoo...@ntc.com QAContact: rsync...@samba.org Created attachment 9998 --> https://bugzilla.samba.org/attachment.cgi?id=9998 Patch to change cmp_time() to use difftime(3) In rsync-3.1.1pre1, if time_t is a signed integer, the cmp_time() function in util.c returns an incorrect result if one of its arguments is far in the past and the other is close to the present or in the future. This causes rsync to treat the times as equal when they actually differ by many years. For example, if time_t is a 32-bit signed integer, when cmp_time() is called with the following times (in either order): 1401411396 (May 30 00:56:36 2014) -2146953600 (Dec 20 00:00:00 1901) it returns 0, indicating that the times should be treated as the same, not the expected -1 or +1, indicating that the times are different. This behavior is apparently caused by integer overflows in the subtraction operations in the conditional expressions on lines 1322 and 1326 of util.c. The difference between two signed integer values can be greater than can be represented in a signed integer of the same size. Attached is a patch to change cmp_time() to use the difftime() library function, available in C89 and later, to compute the difference between the time_t values. -- Configure bugmail: https://bugzilla.samba.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. -- Please use reply-all for most replies to avoid omitting the mailing list. To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html