summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWayne Davison <wayne@opencoder.net>2022-10-01 08:23:47 -0700
committerWayne Davison <wayne@opencoder.net>2022-10-02 09:54:54 -0700
commitfdf5e577f59cf709eb3559137ce3be1431522d07 (patch)
treee70283988e21936f6b7a81b68121ad92ba859326
parent19bd0dd34022d0b8e2ae45f12029602f129c28c1 (diff)
downloadrsync-fdf5e577f59cf709eb3559137ce3be1431522d07.tar.gz
Read a 4-byte mtime as unsigned (old-protocol).
When conversing with a protocol 29 or earlier rsync, the modtime values are arriving as 4-byte integers. This change interprets these short values as unsigned integers, allowing the time that can be conveyed to range from 1-Jan-1970 to 7-Feb-2106 instead of the signed range of 13-Dec-1901 to 19-Jan-2038. Given that we are fast approaching 2038, any old-protocol transfers will be better served using the unsigned range rather than the signed. It is important to keep in mind that protocol 30 & 31 convey the full 8-byte mtime value (plus nanoseconds), allowing for a huge span of time that is not affected by this change.
-rw-r--r--flist.c2
-rw-r--r--io.c7
2 files changed, 8 insertions, 1 deletions
diff --git a/flist.c b/flist.c
index 82d686a6..65b459b1 100644
--- a/flist.c
+++ b/flist.c
@@ -836,7 +836,7 @@ static struct file_struct *recv_file_entry(int f, struct file_list *flist, int x
}
#endif
} else
- modtime = read_int(f);
+ modtime = read_uint(f);
}
if (xflags & XMIT_MOD_NSEC)
#ifndef CAN_SET_NSEC
diff --git a/io.c b/io.c
index f3d802ec..a99ac0ec 100644
--- a/io.c
+++ b/io.c
@@ -1784,6 +1784,13 @@ int32 read_int(int f)
return num;
}
+uint32 read_uint(int f)
+{
+ char b[4];
+ read_buf(f, b, 4);
+ return IVAL(b, 0);
+}
+
int32 read_varint(int f)
{
union {