diff options
author | luochunbei <luochunbei@zju.edu.cn> | 2021-10-10 14:39:51 +0800 |
---|---|---|
committer | luochunbei <luochunbei@zju.edu.cn> | 2021-10-10 14:39:51 +0800 |
commit | e0ca33132dea493dae43f9ccdcd21dda5a1f3161 (patch) | |
tree | 0e378c438dfbf16d5f28ff72d7d0c591aa069e35 | |
parent | cbf1d729ed70b7edd65662df103751b914f91114 (diff) | |
download | libfaketime-e0ca33132dea493dae43f9ccdcd21dda5a1f3161.tar.gz |
add explicit data type conversion to avoid integer overflow
-rw-r--r-- | src/time_ops.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/time_ops.h b/src/time_ops.h index 9b883a4..3614cf2 100644 --- a/src/time_ops.h +++ b/src/time_ops.h @@ -61,7 +61,7 @@ do \ { \ int64_t tmp_time; \ - tmp_time = (c) * (int64_t) ((tvp)->tv_sec * SEC_TO_##prefix##SEC + \ + tmp_time = (c) * (int64_t) ((int64_t) (tvp)->tv_sec * SEC_TO_##prefix##SEC + \ (int64_t) (tvp)->tv_##prefix##sec); \ (result)->tv_##prefix##sec = tmp_time % SEC_TO_##prefix##SEC; \ (result)->tv_sec = (tmp_time - (result)->tv_##prefix##sec) / \ |