mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-04 01:40:16 +01:00
keyfile: be more strict when reading integer values
Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
parent
8d3618a07b
commit
9af77c570e
1 changed files with 3 additions and 2 deletions
|
|
@ -97,10 +97,11 @@ static gboolean
|
|||
get_one_int (const char *str, guint32 max_val, const char *key_name, guint32 *out)
|
||||
{
|
||||
long tmp;
|
||||
char *endptr;
|
||||
|
||||
errno = 0;
|
||||
tmp = strtol (str, NULL, 10);
|
||||
if (errno || (tmp < 0) || (tmp > max_val)) {
|
||||
tmp = strtol (str, &endptr, 10);
|
||||
if (errno || (tmp < 0) || (tmp > max_val) || *endptr != 0) {
|
||||
g_warning ("%s: ignoring invalid IP %s item '%s'", __func__, key_name, str);
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue