In preparation for a hypervisor change also include the nul terminator in
the size calculations. (Note that xc_flask_getbool_byid() doesn't support
FLASK_GETBOOL's "ID being -1" variant of operation, and hence doesn't need
fiddling with.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
--- a/tools/libs/ctrl/xc_flask.c
+++ b/tools/libs/ctrl/xc_flask.c
@@ -187,7 +187,8 @@ int xc_flask_getbool_byname(xc_interface
{
int rv;
struct xen_flask_op op = {};
- DECLARE_HYPERCALL_BOUNCE(name, strlen(name),
XC_HYPERCALL_BUFFER_BOUNCE_IN);
+ size_t size = strlen(name) + 1;
+ DECLARE_HYPERCALL_BOUNCE(name, size, XC_HYPERCALL_BUFFER_BOUNCE_IN);
if ( xc_hypercall_bounce_pre(xch, name) )
{
@@ -197,7 +198,7 @@ int xc_flask_getbool_byname(xc_interface
op.cmd = FLASK_GETBOOL;
op.u.boolean.bool_id = -1;
- op.u.boolean.size = strlen(name);
+ op.u.boolean.size = size;
set_xen_guest_handle(op.u.boolean.name, name);
rv = xc_flask_op(xch, &op);
@@ -219,7 +220,8 @@ int xc_flask_setbool(xc_interface *xch,
{
int rv;
struct xen_flask_op op = {};
- DECLARE_HYPERCALL_BOUNCE(name, strlen(name),
XC_HYPERCALL_BUFFER_BOUNCE_IN);
+ size_t size = strlen(name) + 1;
+ DECLARE_HYPERCALL_BOUNCE(name, size, XC_HYPERCALL_BUFFER_BOUNCE_IN);
if ( xc_hypercall_bounce_pre(xch, name) )
{
@@ -231,7 +233,7 @@ int xc_flask_setbool(xc_interface *xch,
op.u.boolean.bool_id = -1;
op.u.boolean.new_value = value;
op.u.boolean.commit = 1;
- op.u.boolean.size = strlen(name);
+ op.u.boolean.size = size;
set_xen_guest_handle(op.u.boolean.name, name);
rv = xc_flask_op(xch, &op);