summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2021-04-20 13:46:47 +0200
committerThomas Haller <thaller@redhat.com>2021-04-20 17:46:04 +0200
commita2fded3cee0f6d4da86962bfc671f03bfe4c5da4 (patch)
treef274a9358e9680ecfd095c4f7ba13d5bca3b59af
parentd3f07d5ca2a459e3410611902d2de02bb7be1ae7 (diff)
downloadNetworkManager-a2fded3cee0f6d4da86962bfc671f03bfe4c5da4.tar.gz
cloud-setup: use _nm_utils_ascii_str_to_int64_bin() in Azure's _get_config_fetch_done_cb()
-rw-r--r--src/nm-cloud-setup/nmcs-provider-azure.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/nm-cloud-setup/nmcs-provider-azure.c b/src/nm-cloud-setup/nmcs-provider-azure.c
index af2062476c..02b42ce6a6 100644
--- a/src/nm-cloud-setup/nmcs-provider-azure.c
+++ b/src/nm-cloud-setup/nmcs-provider-azure.c
@@ -154,14 +154,9 @@ _get_config_fetch_done_cb(NMHttpClient * http_client,
iface_get_config->has_ipv4s = TRUE;
iface_get_config->ipv4s_len++;
} else {
- int tmp_prefix = -1;
-
- if (fip_len > 0 && memchr(fip_str, '\0', fip_len - 1)) {
- /* we have an embedded "\0" inside the string (except trailing). That is not
- * allowed*/
- } else
- tmp_prefix = _nm_utils_ascii_str_to_int64(fip_str, 10, 0, 32, -1);
+ int tmp_prefix;
+ tmp_prefix = _nm_utils_ascii_str_to_int64_bin(fip_str, fip_len, 10, 0, 32, -1);
if (tmp_prefix == -1) {
_LOGD("interface[%" G_GSSIZE_FORMAT "]: invalid prefix", iface_data->intern_iface_idx);
error =
@@ -244,7 +239,6 @@ _get_config_ips_prefix_list_cb(GObject *source, GAsyncResult *result, gpointer u
((char *) line)[--line_len] = '\0';
ips_prefix_idx = _nm_utils_ascii_str_to_int64(line, 10, 0, G_MAXINT64, -1);
-
if (ips_prefix_idx < 0)
continue;