Commit 511709c5 authored by Thomas Haller's avatar Thomas Haller
Browse files

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.


    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: 95b006c2
parent 0ce73275
......@@ -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");
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment