summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/conf-parser.c2
-rw-r--r--src/shared/util.c8
2 files changed, 5 insertions, 5 deletions
diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c
index 4bf3147f2d..9f5c07c761 100644
--- a/src/shared/conf-parser.c
+++ b/src/shared/conf-parser.c
@@ -865,7 +865,7 @@ int config_parse_mode(
errno = 0;
l = strtol(rvalue, &x, 8);
- if (!x || *x || errno) {
+ if (!x || x == rvalue || *x || errno) {
log_error("[%s:%u] Failed to parse mode value, ignoring: %s", filename, line, rvalue);
return 0;
}
diff --git a/src/shared/util.c b/src/shared/util.c
index 8ec83e49a8..23832fe16a 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -377,7 +377,7 @@ int safe_atou(const char *s, unsigned *ret_u) {
errno = 0;
l = strtoul(s, &x, 0);
- if (!x || *x || errno)
+ if (!x || x == s || *x || errno)
return errno ? -errno : -EINVAL;
if ((unsigned long) (unsigned) l != l)
@@ -397,7 +397,7 @@ int safe_atoi(const char *s, int *ret_i) {
errno = 0;
l = strtol(s, &x, 0);
- if (!x || *x || errno)
+ if (!x || x == s || *x || errno)
return errno ? -errno : -EINVAL;
if ((long) (int) l != l)
@@ -417,7 +417,7 @@ int safe_atollu(const char *s, long long unsigned *ret_llu) {
errno = 0;
l = strtoull(s, &x, 0);
- if (!x || *x || errno)
+ if (!x || x == s || *x || errno)
return errno ? -errno : -EINVAL;
*ret_llu = l;
@@ -434,7 +434,7 @@ int safe_atolli(const char *s, long long int *ret_lli) {
errno = 0;
l = strtoll(s, &x, 0);
- if (!x || *x || errno)
+ if (!x || x == s || *x || errno)
return errno ? -errno : -EINVAL;
*ret_lli = l;