[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH v2 1/2] Add VIR_TYPED_PARAM_STRING

On 09/08/2011 12:59 AM, Hu Tao wrote:
  daemon/remote.c              |   15 +++++++++++++++

Needs a commit comment, documenting compat issues (newer client talking to older server; older client talking to newer server). See my email on v1 about how I think we also need the addition of a new flag, and that no hypervisor driver will send a string unless the new flag is present to say strings are safe.

@@ -519,6 +520,7 @@ struct _virTypedParameter {
          unsigned long long int ul;  /* type is ULLONG */
          double d;                   /* type is DOUBLE */
          char b;                     /* type is BOOLEAN */
+        char *s;                    /* type is STRING */

Can s legitimately be NULL, or is it guaranteed to be non-NULL?

      } value; /* parameter value */

diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 9d34b7e..f4cdc2e 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -1276,6 +1276,13 @@ remoteSerializeTypedParameters(virTypedParameterPtr params,
              val[i].value.remote_typed_param_value_u.b = params[i].value.b;
+            val[i].value.remote_typed_param_value_u.s = strdup(params[i].value.s);

If s can be NULL, this will crash. If s cannot be NULL, then where to we validate it?

Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]