libnm: use nm_strndup_a instead of strndupa

Alpine doesn't have strndupa.

Fixes: 38d1bcee3b ('ip: configurable address pool and lease time of DHCP server in shared mode')
This commit is contained in:
Íñigo Huguet
2024-12-20 20:25:14 +01:00
parent a1b44d1958
commit fdf1a9fb1e

View File

@@ -497,6 +497,7 @@ nm_utils_validate_shared_dhcp_range(const char *shared_dhcp_range,
guint32 interface_network; guint32 interface_network;
guint32 start_ip_length; guint32 start_ip_length;
bool range_is_in_interface_network; bool range_is_in_interface_network;
gs_free char *to_free = NULL;
g_return_val_if_fail(!error || !(*error), FALSE); g_return_val_if_fail(!error || !(*error), FALSE);
@@ -538,7 +539,7 @@ nm_utils_validate_shared_dhcp_range(const char *shared_dhcp_range,
return FALSE; return FALSE;
} }
start_address_str = strndupa(shared_dhcp_range, start_ip_length); start_address_str = nm_strndup_a(200, shared_dhcp_range, start_ip_length, &to_free);
++end_address_str; /* end address is pointing to ',', shift it to the actual address */ ++end_address_str; /* end address is pointing to ',', shift it to the actual address */
if (!nm_inet_parse_bin(AF_INET, start_address_str, NULL, &start_address)) { if (!nm_inet_parse_bin(AF_INET, start_address_str, NULL, &start_address)) {