bind9/lib/isccfg
Aram Sargsyan fddaebb285 Handle large numbers when parsing/printing a duration
The isccfg_duration_fromtext() function is truncating large numbers
to 32 bits instead of capping or rejecting them, i.e. 64424509445,
which is 0xf00000005, gets parsed as 32-bit value 5 (0x00000005).

Fail parsing a duration if any of its components is bigger than
32 bits. Using those kind of big numbers has no practical use case
for a duration.

The isccfg_duration_toseconds() function can overflow the 32 bit
seconds variable when calculating the duration from its component
parts.

To avoid that, use 64-bit calculation and return UINT32_MAX if the
calculated value is bigger than UINT32_MAX. Again, a number this big
has no practical use case anyway.

The buffer for the generated duration string is limited to 64 bytes,
which, in theory, is smaller than the longest possible generated
duration string.

Use 80 bytes instead, calculated by the '7 x (10 + 1) + 3' formula,
where '7' is the count of the duration's parts (year, month, etc.), '10'
is their maximum length when printed as a decimal number, '1' is their
indicator character (Y, M, etc.), and 3 is two more indicators (P and T)
and the terminating NUL character.
2022-10-17 08:45:45 +00:00
..
include Handle large numbers when parsing/printing a duration 2022-10-17 08:45:45 +00:00
aclconf.c Clean up #include <isc/string.h> 2022-05-03 12:38:59 +00:00
dnsconf.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
duration.c Handle large numbers when parsing/printing a duration 2022-10-17 08:45:45 +00:00
kaspconf.c Add isccfg duration utility functions 2022-06-28 11:56:31 +02:00
log.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
Makefile.am Move duration structure to libisccfg/duration 2022-06-28 11:56:31 +02:00
namedconf.c flag "random-device" as ancient 2022-09-14 09:36:58 -07:00
parser.c Handle large numbers when parsing/printing a duration 2022-10-17 08:45:45 +00:00
tests Move all the unit tests to /tests/<libname>/ 2022-05-28 14:53:02 -07:00