aboutsummaryrefslogtreecommitdiffstats
path: root/qom
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-02-03 15:41:13 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2012-02-07 13:52:41 +0100
commit8f770d39056c797a0a3de7a9a1a00befddfb088a (patch)
tree0aa7ef67447016c5a2e52fb23c41624b6d4a4f88 /qom
parent7b7b7d18e40c158134b7588e629be7dd35b468fa (diff)
qom: fix off-by-one
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'qom')
-rw-r--r--qom/object.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/qom/object.c b/qom/object.c
index 212629def..7fd37cb87 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -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;