cloud-setup: use _nm_utils_ascii_str_to_int64_bin() in Azure's _get_config_fetch_done_cb()

This commit is contained in:
Thomas Haller 2021-04-20 13:46:47 +02:00
parent d3f07d5ca2
commit a2fded3cee
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -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;