aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2023-07-16 20:08:35 -0500
committerDenis Kenzior <denkenz@gmail.com>2023-07-16 20:08:35 -0500
commita7945e19bed5352c48f04c9f74dec3a84a2866fa (patch)
treeec1f53b4ccaa5a0988cb5b07a3421c59cd1dabfa
parent8d08a8309e6a460fbde9eafdc3cf39509c9e4b8b (diff)
settings: Use l_safe_atou32
-rw-r--r--ell/settings.c18
1 files changed, 1 insertions, 17 deletions
diff --git a/ell/settings.c b/ell/settings.c
index 72729de6..181bfa8a 100644
--- a/ell/settings.c
+++ b/ell/settings.c
@@ -1123,29 +1123,13 @@ LIB_EXPORT bool l_settings_get_uint(const struct l_settings *settings,
unsigned int *out)
{
const char *value = l_settings_get_value(settings, group_name, key);
- unsigned long int r;
- unsigned int t;
- char *endp;
if (!value)
return false;
- /* Do not allow '+' or '-' or empty string */
- if (!l_ascii_isdigit(*value))
- goto error;
-
- errno = 0;
-
- t = r = strtoul(value, &endp, 0);
- if (*endp != '\0')
- goto error;
-
- if (unlikely(errno == ERANGE || r != t))
+ if (l_safe_atou32(value, out) < 0)
goto error;
- if (out)
- *out = r;
-
return true;
error: