mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-03 16:20:14 +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
(cherry picked from commit 511709c54d)
This commit is contained in:
parent
23d9a5218a
commit
ce88f7c404
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