mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-25 10:40:08 +01:00
cloud-setup: assert that NMHttpClient returns NUL terminated buffer
The behavior is documented at various places, so this assert is less to actually assert it, but as making this condition obvious to the reader of the code.
This commit is contained in:
parent
e3bbd267c3
commit
befd971b45
2 changed files with 8 additions and 2 deletions
|
|
@ -449,6 +449,8 @@ _get_config_metadata_ready_check (long response_code,
|
|||
}
|
||||
|
||||
r_data = g_bytes_get_data (response_data, &r_len);
|
||||
/* NMHttpClient guarantees that there is a trailing NUL after the data. */
|
||||
nm_assert (r_data[r_len] == 0);
|
||||
|
||||
while (r_len > 0) {
|
||||
const guint8 *p_eol;
|
||||
|
|
|
|||
|
|
@ -246,10 +246,11 @@ _get_config_ips_list_cb (GObject *source,
|
|||
if (error)
|
||||
goto fips_error;
|
||||
|
||||
response_str = g_bytes_get_data (response, &response_len);
|
||||
/* NMHttpClient guarantees that there is a trailing NUL after the data. */
|
||||
nm_assert (response_str[response_len] == 0);
|
||||
|
||||
uri_arr = g_ptr_array_new_with_free_func (g_free);
|
||||
response_str = g_bytes_get_data (response, &response_len);
|
||||
|
||||
while (nm_utils_parse_next_line (&response_str,
|
||||
&response_len,
|
||||
&line,
|
||||
|
|
@ -403,6 +404,9 @@ _get_net_ifaces_list_cb (GObject *source,
|
|||
}
|
||||
|
||||
response_str = g_bytes_get_data (response, &response_len);
|
||||
/* NMHttpClient guarantees that there is a trailing NUL after the data. */
|
||||
nm_assert (response_str[response_len] == 0);
|
||||
|
||||
ifaces_arr = g_ptr_array_new ();
|
||||
gstr = g_string_new (NULL);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue