strongswan.org
Wiki/Project Management
Downloads
Gitweb
projects
/
strongswan.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6a8f1b8
)
settings: Add support for hex integers (0x prefix) via get_int()
author
Tobias Brunner
<tobias@strongswan.org>
Tue, 21 Feb 2017 18:12:32 +0000
(19:12 +0100)
committer
Tobias Brunner
<tobias@strongswan.org>
Thu, 2 Mar 2017 07:50:54 +0000
(08:50 +0100)
src/libstrongswan/settings/settings.c
patch
|
blob
|
history
diff --git
a/src/libstrongswan/settings/settings.c
b/src/libstrongswan/settings/settings.c
index
829e784
..
b00e819
100644
(file)
--- 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;