launch: appliance: Fix parsing of QEMU_OPTIONS.

If there was no quoting character, the options could run off the end
of the string and into whatever string which happened to be following
in memory.

This bug was revealed when libguestfs was compiled on arm.
This commit is contained in:
Richard W.M. Jones
2012-12-27 20:01:15 +00:00
parent bcdaa46313
commit 6c9aaf394f

View File

@@ -136,8 +136,12 @@ add_cmdline_shell_unquoted (guestfs_h *g, const char *options)
endp = options + strlen (options);
}
if (quote == ' ')
nextp = endp+1;
if (quote == ' ') {
if (endp[0] == '\0')
nextp = endp;
else
nextp = endp+1;
}
else {
if (!endp[1])
nextp = endp+1;