strongswan/src/libstrongswan/settings
Thomas Egerer 99bef7b686 settings: Use strtoul(3) for settings to int conversion
strtol(3) accepts values in the range of [LONG_MIN;LONG_MAX].  Based
on the architecture (32 or 64 bits), these values expand to either
0x8000000000000000/0x7fffffffffffffff for 64-bit builds, or
0x80000000/0x7fffffff for 32-bit builds.

The behavior when retrieving non-default values for charon.spi_min or
charon.spi_max, for example, depends on the architecture of the target
platform.  While 0xC000001/0xCFFFFFFE work fine on a 64-bit build, on a
32-bit build, due to the use of strtol(3), an ERANGE causes get_int()
to return the default values.

By using strtoul(3) the default is only returned if the input value
exceeds 32 or 64 bits, based on the platform.  Negative values are still
parsed correctly.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2020-03-26 15:26:59 +01:00
..
.gitignore settings: Add flex/bison based parser for strongswan.conf 2014-05-15 11:28:06 +02:00
settings.c settings: Use strtoul(3) for settings to int conversion 2020-03-26 15:26:59 +01:00
settings.h settings: Add reference feature 2018-06-27 14:19:35 +02:00
settings_lexer.l Avoid inclusion of unistd.h in generated lexers 2018-11-22 11:17:35 +01:00
settings_parser.y settings: Don't allow dots in section/key names anymore 2018-09-11 18:30:18 +02:00
settings_types.c settings: Add reference feature 2018-06-27 14:19:35 +02:00
settings_types.h settings: Add reference feature 2018-06-27 14:19:35 +02:00