]> Git Repo - qemu.git/commitdiff
qom: fix off-by-one
authorPaolo Bonzini <[email protected]>
Fri, 3 Feb 2012 14:41:13 +0000 (15:41 +0100)
committerPaolo Bonzini <[email protected]>
Tue, 7 Feb 2012 12:52:41 +0000 (13:52 +0100)
Signed-off-by: Paolo Bonzini <[email protected]>
qom/object.c

index 212629defd1a5d5b889c8eea045ad3f917a5d229..7fd37cb879a0051e346590ba7b92baf3dc0606a0 100644 (file)
@@ -854,11 +854,8 @@ static void object_set_link_property(Object *obj, Visitor *v, void *opaque,
 
         target = object_resolve_path(path, &ambiguous);
         if (target) {
-            gchar *target_type;
-
-            target_type = g_strdup(&type[5]);
-            target_type[strlen(target_type) - 2] = 0;
-
+            /* Go from link<FOO> to FOO.  */
+            gchar *target_type = g_strndup(&type[5], strlen(type) - 6);
             if (object_dynamic_cast(target, target_type)) {
                 object_ref(target);
                 *child = target;
This page took 0.039683 seconds and 4 git commands to generate.