Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion options.c
Original file line number Diff line number Diff line change
Expand Up @@ -1388,7 +1388,10 @@ static time_t parse_time(const char *arg)
return (time_t)-1;
n = 0;
do {
n = n * 10 + *cp++ - '0';
int digit = *cp++ - '0';
if (n > (INT_MAX - digit) / 10)
return (time_t)-1;
n = n * 10 + digit;
} while (isDigit(cp));
if (*cp == ':')
in_date = 0;
Expand Down
13 changes: 13 additions & 0 deletions testsuite/tests/transfer/stop-time.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,19 @@
if proc.returncode == 0:
test_fail("--stop-at with a past time was not rejected")

for opt in (
'--stop-at=20270101000000',
'--stop-at=2147483648-01-01T00:00',
'--stop-at=4294969333-01-01T00:00',
'--stop-at=2037-01-01T4294967296:00',
):
rmtree(TODIR)
proc = run_rsync('-a', opt, f'{src}/', f'{TODIR}/',
check=False, capture_output=True)
if proc.returncode == 0 or 'invalid --stop-at format' not in proc.stderr:
test_fail(f"{opt} was not rejected cleanly "
f"(rc={proc.returncode}, stderr={proc.stderr!r})")

rmtree(TODIR)
run_rsync('-a', '--stop-after=60', f'{src}/', f'{TODIR}/')
for rel in rels:
Expand Down