diff options
Diffstat (limited to 'src/libstrongswan/settings')
-rw-r--r-- | src/libstrongswan/settings/settings.c | 7 | ||||
-rw-r--r-- | src/libstrongswan/settings/settings_types.c | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/libstrongswan/settings/settings.c b/src/libstrongswan/settings/settings.c index 829e78482..b00e8190c 100644 --- a/src/libstrongswan/settings/settings.c +++ b/src/libstrongswan/settings/settings.c @@ -512,11 +512,16 @@ inline int settings_value_as_int(char *value, int def) { int intval; char *end; + int base = 10; if (value) { errno = 0; - intval = strtol(value, &end, 10); + if (value[0] == '0' && value[1] == 'x') + { /* manually detect 0x prefix as we want to avoid octal encoding */ + base = 16; + } + intval = strtol(value, &end, base); if (errno == 0 && *end == 0 && end != value) { return intval; diff --git a/src/libstrongswan/settings/settings_types.c b/src/libstrongswan/settings/settings_types.c index 125676237..d753720f5 100644 --- a/src/libstrongswan/settings/settings_types.c +++ b/src/libstrongswan/settings/settings_types.c @@ -177,7 +177,7 @@ static bool section_purge(section_t *this, array_t *contents) * having any such subsections) are not removed */ for (i = array_count(this->sections_order) - 1; i >= 0; i--) { - array_get(this->sections, i, ¤t); + array_get(this->sections_order, i, ¤t); if (section_purge(current, contents)) { array_remove(this->sections_order, i, NULL); |