diff options
author | David Spisla <david.spisla@iternity.com> | 2019-03-06 12:21:18 +0100 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2019-03-07 12:04:12 +0000 |
commit | ab9b928873024bbc44c941d2ded1b7371f443dd6 (patch) | |
tree | ea6be823f00c5be509d7c5f15679151bec5332d5 /xlators/features/read-only/src/read-only.h | |
parent | 30c6e354b054879dcdadc726cdf5b9a38630f1bb (diff) |
WORM-Xlator: Maybe integer overflow when computing new atime
The structs worm_reten_state_t and read_only_priv_t from read-only.h are
using uint64_t values to store periods of retention and autocommmit.
This seems to be dangerous since in worm-helper.c the function
worm_set_state computes in line 97:
stbuf->ia_atime = time(NULL) + retention_state->ret_period;
stbuf->ia_atime is using int64_t because of the settings of struct
iattr. So if there is a very very high retention period stored, there
is maybe an integer overflow.
What can be the solution? Using int64_t instead if uint64_t may reduce
the probability of the occurance.
Change-Id: Id1e86c6b20edd53f171c4cfcb528804ba7881f65
fixes: bz#1685944
Signed-off-by: David Spisla <david.spisla@iternity.com>
Diffstat (limited to 'xlators/features/read-only/src/read-only.h')
-rw-r--r-- | xlators/features/read-only/src/read-only.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/xlators/features/read-only/src/read-only.h b/xlators/features/read-only/src/read-only.h index b959d2a44fb..fc32f82f8c5 100644 --- a/xlators/features/read-only/src/read-only.h +++ b/xlators/features/read-only/src/read-only.h @@ -19,16 +19,16 @@ typedef struct { uint8_t retain : 1; uint8_t legal_hold : 1; uint8_t ret_mode : 1; - uint64_t ret_period; - uint64_t auto_commit_period; + int64_t ret_period; + int64_t auto_commit_period; } worm_reten_state_t; typedef struct { gf_boolean_t readonly_or_worm_enabled; gf_boolean_t worm_file; gf_boolean_t worm_files_deletable; - uint64_t reten_period; - uint64_t com_period; + int64_t reten_period; + int64_t com_period; int reten_mode; time_t start_time; } read_only_priv_t; |