mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-26 22:50:08 +01:00
dns: fix creating resolv.conf content
g_string_new_len() allocates the buffer with length
bytes. Maybe it should be obvious (wasn't to me), but
if a init argument is given, that is taken as containing
length bytes.
So,
str = g_string_new_len (init, len);
is more like
str = g_string_new_len (NULL, len);
g_string_append_len (str, init, len);
and not (how I wrongly thought)
str = g_string_new_len (NULL, len);
g_string_append (str, init);
Fixes: 95b006c244
This commit is contained in:
parent
0ce7327550
commit
511709c54d
1 changed files with 3 additions and 1 deletions
|
|
@ -589,7 +589,9 @@ create_resolv_conf (char **searches,
|
|||
GString *str;
|
||||
gsize i;
|
||||
|
||||
str = g_string_new_len ("# Generated by NetworkManager\n", 245);
|
||||
str = g_string_new_len (NULL, 245);
|
||||
|
||||
g_string_append (str, "# Generated by NetworkManager\n");
|
||||
|
||||
if (searches && searches[0]) {
|
||||
g_string_append (str, "search");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue