ud3tn/components/bundle6
Felix Walter 2fc9e11b7e bundle: Fix potential uint wrap-around in expiration time calculation
We were taking the current time value in milliseconds and sometimes
subtracting larger values from it. This cleans up the calculations to
always determine the expiration time as uint64_t and compare it against
the current uint64_t timestamp.

It further removes the unnecessary "current timestamp" parameter in
`bundle_get_expiration_time_s` (we now store the reception time with the
bundle, so, do not need this anymore) and avoids a integer wrap-around
case in the function.

Note that the current time cancels out in the age block-based
calculation as we can use the reception timestamp there and offset it by
the calculated relative remaining lifetime.

Found by Clang's UB sanitizer.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2023-05-10 14:31:17 +02:00
..
bundle6.c Insert SPDX license expression comments into our .c, .h, .py, and .sh code 2022-02-20 16:24:38 +01:00
create.c Insert SPDX license expression comments into our .c, .h, .py, and .sh code 2022-02-20 16:24:38 +01:00
fragment.c Add sane behavior in release build where debug triggers assertion 2023-05-10 11:22:51 +02:00
parser.c bundle6/parser: Avoid wrap-around of uint 2023-05-10 14:26:41 +02:00
reports.c bundle: Fix potential uint wrap-around in expiration time calculation 2023-05-10 14:31:17 +02:00
sdnv.c Insert SPDX license expression comments into our .c, .h, .py, and .sh code 2022-02-20 16:24:38 +01:00
serializer.c Insert SPDX license expression comments into our .c, .h, .py, and .sh code 2022-02-20 16:24:38 +01:00