Re: [PATCH v2 1/2] Add VIR_TYPED_PARAM_STRING

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

 



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,
          case VIR_TYPED_PARAM_BOOLEAN:
              val[i].value.remote_typed_param_value_u.b = params[i].value.b;
              break;
+        case VIR_TYPED_PARAM_STRING:
+            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@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]