diff options
| author | Michael Biebl <biebl@debian.org> | 2023-02-23 17:11:22 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2023-02-23 17:11:22 +0100 |
| commit | b22a7b55d0bc5a7999dccaeacdde745f5ace9d66 (patch) | |
| tree | 597d2716cfa4b904c98717b874371e0e7b5e0c71 /src/libnm-core-impl/nm-utils.c | |
| parent | 1372848511cb896b80b51ed1a3e9606bd9816631 (diff) | |
New upstream version 1.42.2 upstream/1.42.2
Diffstat (limited to 'src/libnm-core-impl/nm-utils.c')
| -rw-r--r-- | src/libnm-core-impl/nm-utils.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/libnm-core-impl/nm-utils.c b/src/libnm-core-impl/nm-utils.c index 8ffc070e..c389213f 100644 --- a/src/libnm-core-impl/nm-utils.c +++ b/src/libnm-core-impl/nm-utils.c @@ -5666,7 +5666,8 @@ _nm_utils_ranges_cmp(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_nil) gboolean _nm_utils_iaid_verify(const char *str, gint64 *out_value) { - gint64 iaid; + gint64 i64; + guint32 u32; NM_SET_OUT(out_value, -1); @@ -5676,10 +5677,16 @@ _nm_utils_iaid_verify(const char *str, gint64 *out_value) if (NM_IAID_IS_SPECIAL(str)) return TRUE; - if (NM_STRCHAR_ALL(str, ch, ch >= '0' && ch <= '9') && (str[0] != '0' || str[1] == '\0') - && (iaid = _nm_utils_ascii_str_to_int64(str, 10, 0, G_MAXUINT32, -1)) != -1) { - NM_SET_OUT(out_value, iaid); - return TRUE; + if (NM_STRCHAR_ALL(str, ch, g_ascii_isxdigit(ch) || NM_IN_SET(ch, 'x', ':'))) { + if ((i64 = _nm_utils_ascii_str_to_int64(str, 0, 0, G_MAXUINT32, -1)) != -1) { + NM_SET_OUT(out_value, i64); + return TRUE; + } + + if (nm_dhcp_iaid_from_hexstr(str, &u32)) { + NM_SET_OUT(out_value, u32); + return TRUE; + } } return FALSE; |