Merge branch 'backport-1206-option-nul-termination' into 'glib-2-62'

Backport !1206 “goption: Relax assertion to avoid being broken by kdeinit5” to glib-2-62

See merge request GNOME/glib!1207
This commit is contained in:
Simon McVittie 2019-10-31 16:20:37 +00:00
commit 0a019869bb

View File

@ -1833,8 +1833,10 @@ platform_get_argv0 (void)
NULL))
return NULL;
/* Sanity check for a NUL terminator. */
g_assert (memchr (cmdline, 0, len));
/* g_file_get_contents() guarantees to put a NUL immediately after the
* file's contents (at cmdline[len] here), even if the file itself was
* not NUL-terminated. */
g_assert (memchr (cmdline, 0, len + 1));
/* We could just return cmdline, but I think it's better
* to hold on to a smaller malloc block; the arguments