libxc: Don't write terminating NULL character to command string
authorBoris Ostrovsky <boris.ostrovsky@oracle.com>
Wed, 6 Jan 2016 20:03:21 +0000 (15:03 -0500)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 7 Jan 2016 12:51:06 +0000 (12:51 +0000)
commit8345512febd09e39c55bdf76ee0fb41b32562f45
tree55597ec0a4a4e91f4f41704fc66d1498753ff941
parentdc6d609371217f0afb94531a015b8a8042d35ce4
libxc: Don't write terminating NULL character to command string

When copying boot command string for HVMlite guests we explicitly write
'\0' at MAX_GUEST_CMDLINE offset. Unless the string is close to
MAX_GUEST_CMDLINE in length this write will end up in the wrong place,
beyond the end of the mapped range.

We don't need to limit the size of command string to some arbitrary
number. Any size that can be successfully allocated and mapped is valid
and so the string is guaranteed to be NULL-terminated (since we use
strlen, which needs terminating '\0', to calculate allocation size).

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
tools/libxc/xc_dom_x86.c