diff options
author | Wayne Davison <wayne@opencoder.net> | 2020-07-12 21:51:51 -0700 |
---|---|---|
committer | Wayne Davison <wayne@opencoder.net> | 2020-07-12 22:45:01 -0700 |
commit | 91fff802b9513cf0ed616d3aea170d561f899fae (patch) | |
tree | a2ff6ab53afd4a6a3dee6fd28a4939e1a2cdcf04 /options.c | |
parent | 3c8ac20d63937e73aa8084679344c39916a93813 (diff) | |
download | rsync-91fff802b9513cf0ed616d3aea170d561f899fae.tar.gz |
Check for overflow the right way.
Diffstat (limited to 'options.c')
-rw-r--r-- | options.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -119,7 +119,6 @@ size_t bwlimit_writemax = 0; int ignore_existing = 0; int ignore_non_existing = 0; int need_messages_from_generator = 0; -time_t stop_at_utime = 0; int max_delete = INT_MIN; OFF_T max_size = -1; OFF_T min_size = -1; @@ -130,6 +129,7 @@ int checksum_seed = 0; int inplace = 0; int delay_updates = 0; int32 block_size = 0; +time_t stop_at_utime = 0; char *skip_compress = NULL; char *copy_as = NULL; item_list dparam_list = EMPTY_ITEM_LIST; @@ -2051,7 +2051,7 @@ int parse_arguments(int *argc_p, const char ***argv_p) long val; arg = poptGetOptArg(pc); stop_at_utime = time(NULL); - if ((val = atol(arg) * 60) <= 0 || val + (long)stop_at_utime < 0) { + if ((val = atol(arg) * 60) <= 0 || LONG_MAX - val < stop_at_utime || (long)(time_t)val != val) { snprintf(err_buf, sizeof err_buf, "invalid --stop-after value: %s\n", arg); return 0; } |